2011-06-13 64 views
0

我得到完整的回傳 - 我有一個鏈接按鈕在中繼器和onclick我想綁定一個列表視圖。Updatepanel轉發器LinkBut​​ton OnClick綁定ListView

兩者都在同一個更新面板中。

這是一個usercontrol而不是一個aspx頁面。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

using umbraco.Linq.Core; 
using System.Web.UI.HtmlControls; 

using TechReady; 

public partial class usercontrols_VideoGallery : System.Web.UI.UserControl 
{ 
    public TechReadyDataContextDataContext techDataContext; 

    protected void Page_Load(object sender, EventArgs e) 
    {  
      Bind_Tracks(); 
    } 

    protected void Bind_Tracks() 
    { 
     techDataContext = new TechReadyDataContextDataContext(); 
     var tracks = from t in techDataContext.Tracks 
        orderby t.Title 
        select t; 
     TracksListRepeater.DataSource = tracks; 
     TracksListRepeater.DataBind(); 
     techDataContext.Dispose(); 
    } 

    protected void Bind_VideoGallery(string tracktitle) 
    { 
     techDataContext = new TechReadyDataContextDataContext(); 
     var sessions = (from s in techDataContext.Sessions 
         where s.SessionTrack == tracktitle      
         orderby s.SessionTrack 
         select s); 
     VidGalListView.DataSource = sessions; 
     VidGalListView.DataBind(); 
     techDataContext.Dispose(); 
    } 

    protected void TabLink_Click(Object sender, EventArgs e) 
    { 
      LinkButton lb = (LinkButton)sender; 
      RepeaterItem ri = (RepeaterItem)lb.NamingContainer; 
      HtmlGenericControl litostyle2 = (HtmlGenericControl)ri.FindControl("tablinkli"); 
      litostyle2.Attributes.Add("Class", "ui-tabs-selected"); 
      Bind_VideoGallery(lb.CommandArgument); 
    } 

    protected void TracksListRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) 
    { 
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
     { 
      LinkButton lb = (LinkButton)e.Item.FindControl("tablink"); 
      ScriptManager1.RegisterAsyncPostBackControl(lb);    
     } 

    } 

    protected void TracksListRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e) 
    { 
     if (e.CommandName == "TabClicked") 
     { 


     } 
    } 
} 

回答

0

我有2個scriptmanagers運行 - 一個母版頁上...

0

我最近遇到同樣的問題來了:更新面板的內部中繼內一個LinkBut​​ton。當點擊linkbutton時,我發現了兩種解決方案來執行異步回發。
1.添加以下的屬性頁面指令包含中繼&的LinkBut​​ton:

​​
2.使用上的ScriptManager爲轉發的數據綁定事件:

LinkButton linkButton = e.Item.FindControl("button") as LinkButton; ScriptManager.RegisterAsyncPostBackControl(linkButton)

相關問題