【发布时间】:2016-05-31 09:20:42
【问题描述】:
我使用的是 Visual Studio 2010,而对于数据库,我使用的是 Entity Framework 4。
在我的页面中,我有 3 个选项卡,在第二个选项卡中,我使用 Grid 视图来显示 Employee 的详细信息。在该网格视图中有 2 个图像按钮,一个用于删除另一个用于编辑。每当我单击编辑图像按钮时,我都想打开一个弹出框。
问题是 1.弹出框只出现一秒钟。 2.能够检索Grid视图的行索引。但是没有值传递到其他文本框中,它显示空值,即 name0.Text=""
在我的 .aspx 页面中,我有以下内容
图片按钮
<asp:ImageButton ID="edit" runat="server" CommandArgument='<%# Bind("EmpID")%>' CommandName="edituser" ImageUrl="image/images.jpg" ToolTip="Edit User Details" OnClick="EditUser_Clicked"> </asp:ImageButton>
对于 ModalPopupExtender
<asp:ToolkitScriptManager ID="Toolkitmgr" runat="server"></asp:ToolkitScriptManager>
<asp:HiddenField ID="EmpID" runat="server"
onvaluechanged="EmpID_ValueChanged"/>
<asp:ModalPopupExtender ID="mpedit" DropShadow="true" BackgroundCssClass="modalBackground"
PopupControlID="pnedit" CancelControlID="btnCancel"
runat="server" TargetControlID="EmpID"></asp:ModalPopupExtender>
<asp:Panel runat="server" ID="pnedit" CssClass="modalPopup" Style="display: block;width:525px">
***Some Code***
</asp:Panel>
在 EditUser_Clicked 事件的服务器端代码中,我有以下内容:
protected void EditUser_Clicked(object sender, EventArgs e)
{
ImageButton btndetails = sender as ImageButton;
GridViewRow row = (GridViewRow)btndetails.NamingContainer;
lblId.Text = GridView1.DataKeys[row.RowIndex].Value.ToString();
name0.Text = row.Cells[1].Text;
desig0.Text = row.Cells[2].Text;
dob0.Text = row.Cells[3].Text;
email0.Text = row.Cells[4].Text;
country0.Text = row.Cells[5].Text;
city0.Text = row.Cells[6].Text;
add0.Text = row.Cells[7].Text;
hq0.Text = row.Cells[8].Text;
rbtnListGender0.Text = row.Cells[9].Text;
mobno0.Text = row.Cells[10].Text;
this.mpedit.Show();
}
代码运行没有错误,但模式弹出窗口不可见。请帮我找出我的错误。
【问题讨论】:
-
尝试将您的标记代码,即您的面板放入 UpdatePanel。
-
@ManishGoswami 我也尝试过 UpdatePanel。
标签: c# asp.net modalpopupextender