如何在数据列表按钮中传递查询字符串 [英] how to pass query string in button of datalist
本文介绍了如何在数据列表按钮中传递查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我单击数据列表中的按钮,是否有人可以提供代码,它将查询字符串传递到另一个页面.
Can Anyone giv code for if i click a button of datalist it will pass querystring to another page.
推荐答案
将您的查询字符串值绑定到Button控件的CommandArgument属性.在DataList Control的DataList1_ItemCommand
事件内找到值,然后从此处重定向页面.
Bind your querystring value to CommandArgument property of Button control. Find the value insideDataList1_ItemCommand
event of DataList Control, and redirect the page from here.
protected void DataList1_ItemCommand(object source,
DataListCommandEventArgs e)
{
Button btn = source as Button;
if (btn != null && convert.toString(btn.CommandArgument) != string.empty)
{
response.redirect("Defaut2.aspx?UserId="+btn.CommandArgument.toString())
}
}
请点击链接以了解更多信息..
http://msdn.microsoft .com/zh-CN/library/system.web.ui.webcontrols.datalist.itemcommand(v = VS.100).aspx
Anil Pandya:)
follow the link to learn more..
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.itemcommand(v=VS.100).aspx
Anil Pandya :)
请参阅:
http://www.justskins.com/forums/asp-button-in-a- 40150.html [^ ]
Refer this:
http://www.justskins.com/forums/asp-button-in-a-40150.html[^]
这篇关于如何在数据列表按钮中传递查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文