asp.Net RepeaterでButtonがコミットしたテキストボックスの値を取得

626 ワード

 protected void btnAddFJ_Click(object sender, EventArgs e)
        {
            Button bt = sender as Button;
            RepeaterItem rptItem = bt.Parent as RepeaterItem;
            TextBox txt = rptItem.FindControl("txtFJName") as TextBox;
            //ScriptManager.RegisterStartupScript(this.btnShow, this.GetType(), "myscript", "alert('" + txt.Text + "');", true);
            ScriptManager.RegisterStartupScript(this.btnShow, this.GetType(), "myscript", "navtabshow();", true);
        }
効果: