简体   繁体   English

单击按钮时将listview的值传递给文本框

[英]Passing value for listview to textbox on button click

My list view has a link button: 我的列表视图有一个链接按钮:

Aspx: Aspx:

 <AlternatingItemTemplate>
                <tr style="background-color:#FFF8DC;">

                    <td>
                        <asp:LinkButton ID="CaseNumberLabel" runat="server" Text='<%# Eval("CaseNumber") %>'  CommandArgument='<%# Eval("CaseNumber") %>' OnCommand="lkbCommandAction_Command"  />
                    </td>

C# C#

     protected void lkbCommandAction_Command(object sender, CommandEventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
        TextBox1.Text = 
    }

How can I pass the value to the Textbox1.Text on click? 如何在单击时将值传递给Textbox1.Text?

If you are talking about text of linkbutton itself then you can use the linkbutton Text property to set to TextBox like (Assuming your ListView name is lstview1 ) 如果您正在谈论linkbutton本身的文本,则可以使用linkbutton Text属性设置为TextBox例如(假设ListView名称为lstview1

 protected void lkbCommandAction_Command(object sender, CommandEventArgs e)
{
    MultiView1.ActiveViewIndex = 1;
    TextBox1.Text = ((LinkButton)this.lstview1.FindControl("lkbCommandAction")).Text;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM