I have a button inside of a gridview's template field. Onclick i want to the button to open up a modal popup while force updating the updatepanel and formview inside the modal popup because the formview's datasource depends on a hidden field in which i am setting after click also.
This is what i have so far.
protected void bttnEdit_Click2(object sender, ImageClickEventArgs e)
{
ImageButton bttnEdit = (ImageButton)sender;
HiddenField HiddenField1 = (HiddenField)FormView1.FindControl("HiddenField1");
HiddenField1.Value = bttnEdit.CommandArgument;
UpdatePanel UpdatePanel3 = (UpdatePanel)FormView1.FindControl("UpdatePanel3");
AjaxControlToolkit.ModalPopupExtender ModalPopupExtender1 = (AjaxControlToolkit.ModalPopupExtender)FormView1.FindControl("ModalPopupExten开发者_JS百科der1");
ModalPopupExtender1.Show();
FormView3.DataBind();
UpdatePanel3.Update();
}
I see the popup but nothing on the inside loads. What am I doing wrong?
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
</EditItemTemplate>
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel21" runat="server">
<ContentTemplate>
<asp:ImageButton ID="bttnEdit" CommandArgument = '<%# Eval("Id") %>' runat="server" OnClick ="bttnEdit_Click2" injid='<%# Eval("Id") %>' causeid='<%# Eval("C_Type") %>' natureid='<%# Eval("n_type") %>' CausesValidation="False" ImageUrl="~/images/bttnEdit.gif" Text="Edit" OnClientClick ="loadmodal(this.injid,this.causeid,this.natureid);" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/images/bttnDelete.gif" Text="Delete" />
</ItemTemplate>
<asp:Panel ID = "Pnlmodal" runat ="server" style="background-color:White; padding:1em 6px;">
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode ="Conditional" ChildrenAsTriggers ="true" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID ="Button1" EventName ="Click" />
</Triggers>
<ContentTemplate>
<asp:FormView ID="FormView2" runat="server" DefaultMode ="Edit" DataSourceID ="SqlDataSource8">
<EditItemTemplate>
<table>
<tr>
<td colspan="2" align="center" style="color:Blue;font-size:large">Edit Injury</td>
</tr>
<tr>
<td align="right" ><strong>What event caused the injury </strong></td>
<td align="left"> <asp:UpdatePanel ID="UpdatePanel14" runat="server">
<ContentTemplate>
////stuff
</ContentTemplate>
</UpdatePanel>
Your FormView in your modal is named FormView2 however your code Databinds FormView3. Could you happenly be binding the wrong FormView
精彩评论