Click here to Skip to main content
16,021,211 members

Comments by Member 8532756 (Top 3 by date)

Member 8532756 9-Feb-12 3:24am View    
only first time the ddl will be populated but for second time it will not show any data
Member 8532756 8-Feb-12 0:02am View    
In the above code i have used update panel for placeholder on the .aspx and even i have used trigger in update panel but than also it wont work.For the first time the above code is running fine but when one more usercontrol is it does not show any data in ddl.now here i tried to remove Ispostback at usercontrol .cs page than also it wont work.
Member 8532756 7-Feb-12 23:51pm View    
//This is the code for usercontrol which i have written
protected void Page_Load(object sender, EventArgs e)
{

if (IsPostBack)
{
//Binding the years to DropDownLists.
string date = System.DateTime.Now.ToString("yyyy");
for (int i = 1981; i <= int.Parse(date); i++)
{
ddlFromYear.Items.Add(i.ToString());
ddlToYear.Items.Add(i.ToString());

}


//Binding University to Dropdownlist

//Binding Colleges to Dropdownlist

//Binding Qualification to Dropdownlist

}
}
//on page load of aspx page one usercontrol is loaded as abydefault and second Usercontrol is added on button click
//And for aspx page i have added UC on add button click its code is as follows:

protected void btnAddAca_Click(object sender, EventArgs e)
{
//When candidate click on Add button...
//add new user control
Control ucNew1 = LoadControl("~/usercontrols/UpdateAcadamicDetails.ascx");

HtmlGenericControl tempDiv1 = new HtmlGenericControl();
tempDiv1.Attributes.Add("runat", "server");
tempDiv1.ID = "divAcaControl" + int.Parse(ViewState["COUNT2"].ToString());
tempDiv1.Controls.Add(ucNew1);
//PHAca is a placeholder on aspx page
PHAca.Controls.Add(tempDiv1);
}

********************************************************************




I have used
if(!IsPostBack)
{
// code here
}

but only first time the ddl will be populated but for second time it will not show any data.......