Click here to Skip to main content
16,018,318 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hello , i am adding user controls to a form by selecting a dropdown items
when i clicking a insert button on each user control for first time is not working but for the second time is working

what can i doing?
user control page_load

C#
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        //if ( IsPostBack)
        //    return;


        if (Request.QueryString["ctc"] != null)
        {
            HIDctg_Id.Value = Request.QueryString["ctc"];
        }
        if (Request.QueryString["id"] != null)
        {
            hdnID.Value = Request.QueryString["id"].ToString();
            Equipment.Entities.eqp_IEC600441ClassP  _iec = _eqp_IEC600441ClassPService.FindByiec_Id (Convert.ToInt64(hdnID.Value));
            _eqp_IEC600441ClassP = _iec;
            eqp_IEC600441ClassP = _iec;

        }
        else
        {
            hdnID.Value = "0";
            BTNDelete.Visible = false;

        }

    }
    catch
    {
    }
  }


form code :::
C#
protected override void OnLoad(EventArgs e)
 {

         base.OnLoad(e);

             CreateStandardsCoreUC();

 }
 public void CreateStandardsCoreUC() {
     if (ddl_CoresStandards.SelectedValue != "select")
     {
         Control uc = (Control)Page.LoadControl(getUserControl(ddl_CoresStandards.SelectedValue));
         pnlUC.Controls.Add(uc);

     }

 }
Posted
Updated 17-Jul-12 0:02am
v2
Comments
Mohamed Mitwalli 15-Jul-12 1:10am    
Share your code ..
Sandeep Mewara 15-Jul-12 2:50am    
Incomplete. Until you share related code snippet, difficult for anyone to comment.
faezeh66 17-Jul-12 6:02am    
i update it by my codes
Sandeep Mewara 17-Jul-12 6:31am    
Another thing, what did you observed when you used Visual studio DEBUGGER? What was the workflow?

1 solution

solved by uc.ID = ddl_CoresStandards.SelectedItem.Text + "1";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900