Click here to Skip to main content
14,865,088 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
I have accordian pan menu which is loading from XML menu.

When I press any link in menu, it is opening respective page. When I enter data in some text boxes and then press same link in menu the page ispostback is not working. The entered data remains same.

How to clear enter data i.e I need to open a new form, but it is opening same form with data.

C#
string _user_role;


        protected void Page_Load(object sender, EventArgs e)
        {
            int rowid = -1;

            //if (!IsPostBack)
            //{
            #region Code for Menu
            DataSet ds = new DataSet();
            DataTable dt1 = new DataTable();
            try
            {

                //By Dileep [5Jan11] - to add Session of UserRole
                //dt1 = DALAuthentication.GetUserRoleName(Session["UserID"].ToString());
                //_user_role = dt1.Rows[0][0].ToString();
                if (Session["RoleName"] == null)
                {
                    Session.Abandon();
                    Response.Redirect("login.aspx");
                }
            
                else
                {
                    _user_role = Session["RoleName"].ToString();
                    ds.ReadXml(Server.MapPath("~/XmlData/" + _user_role + ".xml"));
                }
                //End Dileep
            }
            catch
            {
                if (Session["RoleName"] == null)
                {

                    Session.Abandon();
                    Response.Redirect("login.aspx");
                }
                else
                {
                    Response.Write("<script language='javascript'>alert('User:" + Session["UserID"].ToString() + " Role not exists');</script>");
                    return;
                }
            }
            DataRow[] found2ndDBRows;
            DataRow[] found2ndDBRows1;
            DataRow[] found2ndDBRows2;
            string strDBExpr1;
            foreach (DataRow drRow in ds.Tables[0].Rows)
            {
                if (drRow["value"].ToString() == "Operations")
                // if (drRow["value"].ToString() != "")
                {
                    string strDBExpr = "value = '" + "Operations" + "'";
                    found2ndDBRows = ds.Tables[0].Select(strDBExpr, string.Empty);
                    foreach (DataRow str in found2ndDBRows)
                    {
                        if (rowid != Convert.ToInt32(str[0].ToString()))
                        {
                            strDBExpr1 = "type_id = " + str[0].ToString() + "";
                            rowid = Convert.ToInt32(str[0].ToString());
                            found2ndDBRows1 = ds.Tables[1].Select(strDBExpr1, string.Empty);

                            foreach (DataRow str3 in found2ndDBRows1)
                            {
                                string strDBExpr2 = "ActionType_id = " + str3[0].ToString() + "";
                                found2ndDBRows2 = ds.Tables[2].Select(strDBExpr2, string.Empty);
                                AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();
                                pane.ID = strDBExpr2;
                                PaneHTMLTemplate header = new PaneHTMLTemplate(" <div  >" + " <a href=''  önclick='return false;' >" + str3[1].ToString() + "" + "</a></div>");

                                pane.Header = header;



                                foreach (DataRow str1 in found2ndDBRows2)
                                {
                                    LinkButton lb = new LinkButton();
                                    lb.Text = str1[0].ToString();
                                    lb.ID = str1[0].ToString() + "-link";
                                    lb.PostBackUrl = str1[1].ToString();
                                    lb.CommandArgument = str1[0].ToString();
                                    lb.Click += new EventHandler(lb_Click);
                                    lb.CssClass = "accordionContent";
                                    pane.ContentContainer.Controls.Add(lb);
                                    Panel innerpan = new Panel();
                                    innerpan.ID = str1[0] + "_pan";
                                    innerpan.Controls.Add(lb);
Posted
Updated 11-Feb-11 14:27pm
v3
Comments
[no name] 10-Feb-11 1:09am
   
what code you wrote for this?
Sunasara Imdadhusen 10-Feb-11 1:13am
   
Don't use URGENT word in your question!!
karthikkushala 10-Feb-11 7:10am
   
sorry but its creating lot of problem
Sunasara Imdadhusen 10-Feb-11 7:22am
   
And your question is not clear!! Please what's exact problem you have?
YangQy 10-Feb-11 9:25am
   
Plus use 'code block' tag for your code so we can help faster
Prerak Patel 10-Feb-11 9:28am
   
What do you mean by "page ispostback not working"?! Are you asking for EnableViewState?
thatraja 10-Feb-11 12:46pm
   
Move your code into your question....also it's not even complete one there. So include right code in your question & also mention the error message, etc., details there
DaveAuld 11-Feb-11 20:28pm
   
Code moved from Comment to Question, comment deleted.

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