Click here to Skip to main content
16,022,536 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Master page load
C#
if (!IsPostBack)
           
        {
        string sql1 = "sql query";
        DataTable dt = obj.RunSqlReturnDT(sql1);          
        Accordion1.DataSource = dt.DefaultView;
        Accordion1.DataBind();
       }

       Accordion1_ItemDataBound Event(Repeater bind inside accordion AS MENU)
       protected void Accordion1_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e)
       {
         
        if (e.ItemType == AjaxControlToolkit.AccordionItemType.Header)
        {

            string a = (e.AccordionItem.FindControl("Label4") as Label).Text;
            ViewState["Categoryname"] = a;
        }
        if (e.ItemType == AjaxControlToolkit.AccordionItemType.Content)
        {
            string cat_name = ViewState["Categoryname"].ToString();
            sql ="sql query";
            Repeater Repeater1 = (Repeater)e.AccordionItem.FindControl("Repeater1");
            DataTable dt = obj.RunSqlReturnDT(sql11);
            Repeater1.DataSource = dt;
            Repeater1.DataBind();

        }
       
    }


i want to stop re-bind of accordion again & again ...its rebind the whole.. my problem is i want to find the last click option and focus it..

Thanks In Advance!!
Posted
Updated 14-Feb-12 19:32pm
v4

1 solution

Hi,

If you are saving the last selection always through out the session,
1.Declare a session variable.
2.store the selection in that variable on click of the menu.
3.In the page !postback event check whether the session variable is null.
4.If null, bind the menu.

Hope this helps.
 
Share this answer
 
v2
Comments
ankitaverma 15-Feb-12 1:58am    
i have already tried so..but in this case the menu doesn't binds on second page load....
Sudip Saha 15-Feb-12 2:15am    
Then do one thing in the 2nd page load event with in !ispostback keep that session variable =null
manognya kota 15-Feb-12 2:03am    
Do you always want to keep that last selection through out the session of that application? Also, dint get what do you mean by second page load?Do you have 2 pages?
ankitaverma 15-Feb-12 2:46am    
second page load means that when menu item clicked then the url will redirected to second page and menu binds again ..
Vishwajeet Singh Chouhan 15-Feb-12 2:05am    
sahi hai......

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