Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Runtime Accordianpane goes off once button is clicked

$
0
0

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");

}

privatevoid myFunction(string EId, string AnotherId)

    {

       AppDs=MyClass.GetQuetionaire(Eid,AnotherId)

if (AppDs!=null)

{

        AjaxControlToolkit.AccordionPane Pane = new AjaxControlToolkit.AccordionPane();

    Label lblHeader =newLabel();

        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 =newTextBox();

        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 = newImageButton();

        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 +=newImageClickEventHandler(ImageButton1_Click);

        Pane.ContentContainer.Controls.Add(Btn);

        Accordion1.Panes.Add(Pane);

    }

}

protectedvoid 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.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>