2012-03-28 87 views
0

我的这个ajax ConfirmButtonExtender在我的页面中,ConfirmText设置为一个静态值你确定要取消这个命令吗?现在动态设置Ajax ConfirmButtonExtender ConfirmText值

<ajaxToolKit:ConfirmButtonExtender ID="cbe_btnVoid" runat="server" ConfirmText="Are you sure you want to void this order?" Enabled="True" TargetControlID="btnTarget" /> ' 

,我创建了代替confirmtext的静态值的所谓返回字符串的函数如下:

public static string setConfirmTextValue() 
{ 
    return "Note:\n\nThis will void your order.\n\nProceed?"; 
} 

以上功能的按钮内一起使用时, gridview并相应地显示confirmtext,但是当在页面上的按钮中使用时,确认文本是空白的。我在gridview中设置Button的confirmtext值如下:

ConfirmText='<%# Utils.setConfirmTextValue() %>' 

我在gridview外面使用了相同的按钮。对此有任何建议/想法...

回答

1

如果您要为扩展器的ConfirmText设置在GridView外部的按钮上,您可以将其设置为您的页面加载。

if(!isPostBack) 
{ 
    cbe_btnVoid.ConfirmText = Utils.setConfirmTextValue(); 
} 

也很可能绑定它无需使用后面的代码的方式,我不记得曾经看到一个使用数据源控件外<%#...%>标签。

+0

我以为我承认过这一点。谢谢。 – 2012-12-06 13:17:18

+0

@jaytapaoan哦,我忘了这件事,很高兴它帮助 – 2012-12-06 13:53:14