如何在单击按钮时从服务器端的转发器获取值
<asp:Repeater ID="rptList" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="15%">
<b>Subject</b>
</td>
<td width="60%">
<%#Eval("Title")%>
</td>
</tr>
我将数据绑定到转发器,并绑定标题值。
string MysqlStatement = "SELECT Title, RespondBy FROM tbl_message WHERE MsgID = @Value1";
using (DataServer server = new DataServer())
{
.. }
rptList.DataSource = ds;
rptList.DataBind();
当在同一页面中单击按钮时,如何获取服务器端标题的值。
<asp:Repeater ID="rptList" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width="15%">
<b>Subject</b>
</td>
<td width="60%">
<%#Eval("Title")%>
</td>
</tr>
I do databind to a repeater, and bind the title value.
string MysqlStatement = "SELECT Title, RespondBy FROM tbl_message WHERE MsgID = @Value1";
using (DataServer server = new DataServer())
{
.. }
rptList.DataSource = ds;
rptList.DataBind();
How can I get the value of title in server side, when a button in clicked in the same page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会将标题放在服务器控件中,就像标签一样,然后您可以执行以下操作:
然后在后面的代码中:
I would put the title in a server control, like a label, and then you can do something like this:
And then in the code behind:
我会将 title 的值设置为您可以调用 FindControl() 的标签的文本。
I would set the value of title to the text of a label that you could call FindControl() on.