locked
composite control with autopostback dropdownlist RRS feed

  • Question

  • User-540975573 posted

    how to handle autopostback dropdownlist in compositecontrol?

    i need to use the selectedvalue of this dropdownlist inside the createcontrol.

    when i select option from ddl we need to create new list of controls which depense on the new selection.

    the problame is the i get the value only after createcontrols was run allready

     

    Monday, June 22, 2009 1:45 AM

Answers

  • User-2106054853 posted

     Hi,

    You can create controls first and set them as visible if needed in later phase.

    If it still doesn't work please upload a demo project to 

    http://skydrive.live.com/

    and paste the download link here for me to test.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 23, 2009 11:50 PM

All replies

  • User-540975573 posted

    how to make my control work like page does it?

    when user selectChanged to create new and fitting control for the selection.

    is there posiable way to get the selectedvalue befor createChildcontrols start.

    thats my dropdownlist part in the control:

    protected override void OnInit(EventArgs e)

    {

    base.OnInit(e);

    ddlGroup = new DropDownList();

    ddlGroup.ID = "ddlGroup";if (Groups.Count > 1)

    {

    ddlGroup.DataSource = Groups;

    ddlGroup.DataTextField =
    "GroupName";ddlGroup.DataValueField = "GroupID";

    ddlGroup.DataBind();

    //ddlGroup.Items.Insert(0, new ListItem("", "0"));

    ddlGroup.AutoPostBack = true;ddlGroup.SelectedIndexChanged += new EventHandler(ddlGroup_SelectedIndexChanged);

    }

    else

    ddlGroup.Visible = false;

    Controls.Add(ddlGroup);

    }

    Monday, June 22, 2009 5:43 AM
  • User-2106054853 posted

     Hi,

    You can create controls first and set them as visible if needed in later phase.

    If it still doesn't work please upload a demo project to 

    http://skydrive.live.com/

    and paste the download link here for me to test.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 23, 2009 11:50 PM