我得到完整的回傳 - 我有一個鏈接按鈕在中繼器和onclick我想綁定一個列表視圖。Updatepanel轉發器LinkButton 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")
{
}
}
}