避免在主页面加载事件时菜单重新绑定(在内部!ISpostback) [英] Avoid Re-Bind of menu on master page load event( Inside !ISpostback)

查看:63
本文介绍了避免在主页面加载事件时菜单重新绑定(在内部!ISpostback)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

母版页加载

Master page load

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!!

推荐答案



如果您始终在整个会话中都保存最后的选择,
1.声明一个会话变量.
2.单击菜单将选择存储在该变量中.
3.在页面!postback事件中,检查session变量是否为null.
4.如果为null,则绑定菜单.

希望这会有所帮助.
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.


这篇关于避免在主页面加载事件时菜单重新绑定(在内部!ISpostback)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆