User635582750 posted
Hi All,
I am using Accordion Control in my ASP.net a Questionaire Application (VS2010), I have drop this control on webform and from codebeind is generate the pane and generate the some controls at runtime, the code is show below.
protected
void
EmpQuestions_GV_SelectedIndexChanged(object
sender, EventArgs
e)
{
myFunction("E001",
"T001");
}
private
void
myFunction(string
EId, string
AnotherId)
{
AppDs=MyClass.GetQuetionaire(Eid,AnotherId)
if (AppDs!=null)
{
AjaxControlToolkit.AccordionPane
Pane = new
AjaxControlToolkit.AccordionPane();
Label lblHeader =
new
Label();
lblHeader.ID ="lblHeader"
+ i.ToString();
lblHeader.Text = AppDs.Tables[0].Rows[i]["Question"].ToString().Trim();
lblHeader.CssClass ="header";
Pane.ID ="accp_"
+ i.ToString();
Pane.HeaderContainer.Controls.Add(lblHeader);
TextBox TB =
new
TextBox();
TB.ID ="TB_"
+ i.ToString();
TB.TextMode =TextBoxMode.MultiLine;
TB.CssClass ="TextBoxText";
TB.Text = AppDs.Tables[0].Rows[i]["Answer"].ToString().Trim();
Pane.ContentContainer.Controls.Add(TB);
ImageButton
Btn = new
ImageButton();
Btn.ID = i.ToString() +"_"
+ AppDs.Tables[0].Rows[i]["QId"].ToString().Trim()
+ "_"
+ AppDs.Tables[0].Rows[i]["EId"].ToString().Trim();
Btn.ImageUrl ="~/Images/Save.png";
Btn.Attributes.Add("runat",
"server");
Btn.Click +=new
ImageClickEventHandler(ImageButton1_Click);
Pane.ContentContainer.Controls.Add(Btn);
Accordion1.Panes.Add(Pane);
}
}
protected
void
ImageButton1_Click(object
sender, ImageClickEventArgs
e)
{
string LblBtn = ((ImageButton)sender).ID;
string[] Id = LblBtn.Split('_');
Seq = Id[0].ToString();
AppId = Id[1].ToString();
Sid = Id[2].ToString();
TextBox T = (TextBox)Page.FindControl("ctl00$Main$accp_"
+ Seq + "_content$TB_"
+ Seq + "");
}
I have a problem , when the Image button is clicked (generated at runtime) the Accordian control get lost with no panes and does not show any control, neither the click event is triggerred.
Could you pls give me some solution where to stop this POSTBACK and regenrate this Accordion Control again.