textbox 增加click事件

<asp:TextBox ID="tb" runat="server" SkinID="forFormSingleLine" ReadOnly="true"></asp:TextBox>
<asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" Visible="false" />
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

tb.Attributes[
"onclick"] = "window.showModalDialog(\"http://www.cnblogs.com/PublicInfo/FrmContractListDlg.aspx"
+ " \",\" \",\"status:false;dialogWidth:800px;dialogHeight:530px\");";
tb.Attributes[
"onclick"] += ClientScript.GetPostBackEventReference(btn, null);
}
}



protected void btn_Click(object sender, EventArgs e)
{
        //to do smth...
      }
原文地址:https://www.cnblogs.com/pchgo/p/2055399.html