比如我页面有个text1文本框
内容由用户写
然后我在gridview中需要做个链接
AAA.ASPX?aaa=text1.text现在我写protected string aa = text1.text
然后
gridview中
DataNavigateUrlFormatString='person.aspx?aaa=<%=aa%>'
但链接出还是
person.aspx?aaa=<%=aa%>
不是我需要的值
请问下怎么修改
内容由用户写
然后我在gridview中需要做个链接
AAA.ASPX?aaa=text1.text现在我写protected string aa = text1.text
然后
gridview中
DataNavigateUrlFormatString='person.aspx?aaa=<%=aa%>'
但链接出还是
person.aspx?aaa=<%=aa%>
不是我需要的值
请问下怎么修改
DataNavigateUrlFormatString='person.aspx?aaa= "+this.text1.text+"'
DataNavigateUrlFormatString='person.aspx?aaa= "+aa+"'
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>测试页面</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form>
</body>
</html>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txt = e.Row.FindControl("TextBox1") as TextBox;
HyperLink link = e.Row.FindControl("HyperLink1") as HyperLink;
link.NavigateUrl = "你的链接&你的参数名称=" + txt.Text;
}
}
能用了
还有个问题
我表中有个id字段
想问下怎么取选中的这个ID字段~~