Click here to Skip to main content
16,007,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

inside a grid view i have 3 buttons (a,b,c). On click of each buttons a modal popup must appear for getting user confirmation.

For this i tried using Ajax toolkit
C#
ModalPopupExtender
but this asks
C#
TargetControlID
in page load itself.

Now i am trying with jquery. here problem is not getting syntax to get client id of this button inside gridview.
Please help me solve this.

thanks in advance
Posted

1 solution

Hi ,
Check this Example with AJAX
Add Css to Grid and it will give you what you need like this Example
CSS
<style type="text/css">
.modalBackground

{
      background-color:Gray;
      filter:alpha(opacity=70);
      opacity:0.7;
}
.ModalWindow
{

  border: solid1px#c0c0c0;
  background:#f0f0f0;
  padding: 0px10px10px10px;
  position:absolute;
  top:-1000px;
}

    </style>


ASP.NET
<div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Button ID="Button2" runat="server" Text="Button" />
                    <asp:ModalPopupExtender ID="Button2_ModalPopupExtender" runat="server" PopupControlID="Panel1" BackgroundCssClass="modalBackground"
                        DynamicServicePath="" Enabled="True" TargetControlID="Button2" CancelControlID="Button3">
                    </asp:ModalPopupExtender>
                    <asp:Panel ID="Panel1" runat="server" CssClass="ModalWindow">
                    Test
                    1
                  2
                        <asp:Button ID="Button3" runat="server" Text="Close" />
                    </asp:Panel>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField></asp:TemplateField>
        </Columns>
    </asp:GridView>

</div>

Best Regards
M.Mitwalli
 
Share this answer
 
v2
Comments
Suraj S Koneri 30-May-12 8:15am    
Thanks for the Answer. But when i use your code i am getting panel inside the Gridview only.. but i want a panel which disables the background. like this ^
Mohamed Mitwalli 30-May-12 8:56am    
Check the solution i already updated

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900