ここにLinkButtonがあり、ポップアップが開きます。 divコンテナ内jqueryポップアップの編集モードが機能しません
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script src="scripts/jquery-ui.js" type="text/javascript"></script>
<link href="scripts/jquery-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function pop() {
$("#dialog").dialog({
title: "Klient",
buttons: {
Close: function() {
$(this).dialog('close');
}
}
});
return false;
};
</script>
、ここですべてのラベル(ID =ダイアログ):
<asp:LinkButton ID="libKlient" OnClick="libKlient_Click" runat="server" /></td>
<div id="dialog" style="display: none;">
<asp:Panel ID="pnlDialog" runat="server">
<h1>Klient
</h1>
<table>
<tr>
<td>Name:</td>
<td>
<asp:TextBox ID="txtName" runat="server" /></td>
</tr>
<tr>
<td>Adress:</td>
<td>
<asp:TextBox ReadOnly="true" ID="txtAdress" runat="server" /></td>
</tr>
<tr>
<td>Phone:</td>
<td>
<asp:TextBox ReadOnly="true" ID="txtPhone" runat="server" /></td>
</tr>
<tr>
<td>Email:</td>
<td>
<asp:TextBox ReadOnly="true" ID="txtEmail" runat="server" /></td>
</tr>
<tr>
<td>Birtday:</td>
<td>
<asp:TextBox ReadOnly="true" ID="txtBirtday" runat="server" /></td>
</tr>
</table>
<asp:Button Text="Edit" ID="btnEdit" OnClick="btnEdit_Click" runat="server" />
</asp:Panel></div>
そして、ここにラベルを読み込みSqldatereader、です。したがって、ユーザーがLinkButton(libKlient)をクリックすると、ポップアップがポップアップし、すべてのテキストボックスが有効になります= false。それまではすべて動く!
protected void libKlient_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "Show Modal Popup", "pop();", true);
string sql = "Select * From Klient WHERE [email protected]";
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Name", GridView1.SelectedDataKey.Values[3].ToString());
using (SqlDataReader r = cmd.ExecuteReader())
{
while (r.Read())
{
try
{
txtName.Text = r["Name"].ToString();
txtName.Enabled = false;
txtAdress.Text = r["Adress"].ToString();
txtAdress.Enabled = false;
\t txtPhone.Text = r["Phone"].ToString();
txtPhone.Enabled = false;
txtEmail.Text = r["Email"].ToString();
txtEmail.Enabled = false;
\t txtBirtday.Text = r["Birtday"].ToString();
txtBirtday.Enabled = false;
}
catch (Exception ex)
{
}
}
}
}
con.Close();
}
}
問題は、編集ボタン(ID = btnEdit)です。ボタンをクリックすると、すべてのテキストボックスが有効になり、false = enabledが有効になります。しかし、それは動作しません。できるだけ早く私は、ポップアップが閉じ、[編集]ボタンをクリックして:ASP.NETのWebフォームで
protected void Read(Control control)
{
foreach (Control c in control.Controls)
{
if (c is TextBox && c.ID.StartsWith("txt"))
((TextBox)c).Enabled = true;
}
}
protected void btnEdit_Click(object sender, EventArgs e)
{
Read(pnlDialog);
}