在使用SlideShowExtender添加后台事件如下:请问我如何传入contextKey这个变量。
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static AjaxControlToolkit.Slide[] GetSlides(string contextKey)
{
string aaa = "select * from MB_Pictures where UID='"+contextKey+"'";
SqlData sql = new SqlData();
DataSet ds = sql.ExceDS(aaa);
//创建Slide数据对象对象,用语存储将要播放的相片。
AjaxControlToolkit.Slide[] ajaxPhoto = new Slide[ds.Tables[0].Rows.Count];
int j = 0;
foreach (DataRowView v in ds.Tables[0].DefaultView)
{
//读取数据库中数据,并存储到Slide数组中。
ajaxPhoto.SetValue(new AjaxControlToolkit.Slide(v[5].ToString().Substring(2), v[2].ToString(), v[4].ToString()), j);
j = j + 1;
}
//AjaxControlToolkit.Slide[] ajaxPhoto = new Slide[1];
return ajaxPhoto; }
如果在前台绑定ContextKey,我想把Session[“UID”]这个变量代进去,该怎么写呢?我试过在后台定义ContextKey,然后绑定,但是老提示错误!请大家帮帮忙。我想根据不同的用户显示各自的图片!
<cc1:SlideShowExtender ID="Image4_SlideShowExtender" runat="server"
ContextKey="" Enabled="True" Loop="True" NextButtonID="rl"
PlayButtonID="auto" PreviousButtonID="ll" SlideShowServiceMethod="GetSlides"
SlideShowServicePath="" TargetControlID="Image4" UseContextKey="True"
ImageDescriptionLabelID="Label7" ImageTitleLabelID="Label6">
</cc1:SlideShowExtender>
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static AjaxControlToolkit.Slide[] GetSlides(string contextKey)
{
string aaa = "select * from MB_Pictures where UID='"+contextKey+"'";
SqlData sql = new SqlData();
DataSet ds = sql.ExceDS(aaa);
//创建Slide数据对象对象,用语存储将要播放的相片。
AjaxControlToolkit.Slide[] ajaxPhoto = new Slide[ds.Tables[0].Rows.Count];
int j = 0;
foreach (DataRowView v in ds.Tables[0].DefaultView)
{
//读取数据库中数据,并存储到Slide数组中。
ajaxPhoto.SetValue(new AjaxControlToolkit.Slide(v[5].ToString().Substring(2), v[2].ToString(), v[4].ToString()), j);
j = j + 1;
}
//AjaxControlToolkit.Slide[] ajaxPhoto = new Slide[1];
return ajaxPhoto; }
如果在前台绑定ContextKey,我想把Session[“UID”]这个变量代进去,该怎么写呢?我试过在后台定义ContextKey,然后绑定,但是老提示错误!请大家帮帮忙。我想根据不同的用户显示各自的图片!
<cc1:SlideShowExtender ID="Image4_SlideShowExtender" runat="server"
ContextKey="" Enabled="True" Loop="True" NextButtonID="rl"
PlayButtonID="auto" PreviousButtonID="ll" SlideShowServiceMethod="GetSlides"
SlideShowServicePath="" TargetControlID="Image4" UseContextKey="True"
ImageDescriptionLabelID="Label7" ImageTitleLabelID="Label6">
</cc1:SlideShowExtender>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货