我有一个页面具有网格视图,并且在项目模板的内部有一个模式弹出扩展器。我怎么也无法从后面的代码中检测到它。
MPE1.Show();
MPE1.Hide();
显示我从后面的代码中应用它们,如下所示:
protected void gvSubscribers_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "edits")
{
int id = Convert.ToInt32(e.CommandArgument);
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = gvSubscribers.Rows[index];
ModalPopupExtender mpe = row.FindControl("MPE1") as ModalPopupExtender;
mpe.BackgroundCssClass = "modal-backdrop fade in";
mpe.CancelControlID = "btnclose";
mpe.Enabled = true;
mpe.PopupControlID = "myModal_autocomplete";
mpe.TargetControlID = "hd";
mpe.Show();
hd_SUBID.Value = id.ToString();
DataTable dt = new DataTable();
string str = "SELECT [Name],[EmailAddress],[MobileNo],[category_id] FROM [dbo].[tbl_Subscribers] s WHERE Id='" + id + "'";
dt = obj.Get_Data_Table_From_Str(str);
txt_subcribername.Text = dt.Rows[0]["Name"].ToString().Trim();
txt_subscriberemail.Text = dt.Rows[0]["EmailAddress"].ToString().Trim();
txt_subscribermobile.Text = dt.Rows[0]["MobileNo"].ToString().Trim();
DAL_ComboFill obj_u = new DAL_ComboFill();
obj_u.Fill_SubscriberCategories_Combo(this, DDL_CategoryList, false, false, int.Parse(CommonLogic.GetSessionValue("type_id").ToString()), int.Parse(CommonLogic.GetSessionValue("user_id").ToString()));
DDL_CategoryList.SelectedValue = dt.Rows[0]["category_id"].ToString().Trim();
}
这只显示了mpe.BackgroundCssClass =“模式背景淡入”;效果无法显示面板内容。
这是我的面板显示的内容:
<asp:Panel ID="myModal_autocomplete" runat="server" CssClass="modal fade in" Style="display:inline-block; padding-right: 17px;">
<asp:HiddenField ID="hd_SUBID" runat="server" />
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<asp:Button ID="btnclose" runat="server" CssClass="close"/>
<h4 class="modal-title">Subscriber Edit</h4>
</div>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-body form">
<div class="form-group">
<label class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<div class="input-group">
<asp:TextBox ID="txt_subcribername" runat="server" CssClass="form-control tt-input" ValidationGroup="EditSubscriber"></asp:TextBox>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Email</label>
<div class="col-sm-8">
<div class="input-group">
<asp:TextBox ID="txt_subscriberemail" runat="server" CssClass="form-control tt-input" ValidationGroup="EditSubscriber"></asp:TextBox>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Mobile No</label>
<div class="col-sm-8">
<div class="input-group">
<asp:TextBox ID="txt_subscribermobile" runat="server" CssClass="form-control tt-input" ValidationGroup="EditSubscriber"></asp:TextBox>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Category</label>
<div class="col-sm-8">
<div class="input-group">
<asp:DropDownList ID="DDL_CategoryList" runat="server" AutoPostBack="true" ValidationGroup="EditSubscriber" CssClass="form-control tt-input" OnSelectedIndexChanged="DDL_CategoryList_SelectedIndexChanged" ></asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="btn_close" runat="server" Text="Close" CssClass="btn grey-salsa btn-outline"/>
<asp:Button ID="btn_update" runat="server" Text="Save changes" CssClass="btn green"/>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DDL_CategoryList" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="btn_close" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btn_update" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</asp:Panel>
我尝试了很多,但没有成功,因此需要将其网格视图放入更新面板中。当我将网格视图放入更新面板时,它给了我类似An extender can't be in a different UpdatePanel than the control it extends asp.net
的错误,我该如何解决。