Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:44:38+00:00 2026-06-18T11:44:38+00:00

I have a gridview and a button inside it. What I want to do

  • 0

I have a gridview and a button inside it. What I want to do is to reference a simple pop-up div from this link. I want to open it on button click.

Here is my HTML Code:

<asp:GridView ID="gvContactUs" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                        DataKeyNames="ContactID" Width="100%" CellPadding="3" CellSpacing="1" OnPageIndexChanging="gvContactUs_PageIndexChanging"
                        OnRowCommand="gvContactUs_RowCommand" OnRowDataBound="gvContactUs_RowDataBound"
                        OnRowDeleting="gvContactUs_RowDeleting" OnSorting="gvContactUs_Sorting" AllowPaging="True"
                        BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" GridLines="None">
                        <Columns>
                            <asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="3%">
                                <ItemTemplate>
                                    <asp:Button Text="text" ID="hello" runat="server" />
                                    <div>
                                        <div id="overlay" class="web_dialog_overlay">
                                        </div>
                                        <div id="dialog" class="web_dialog">
                                            <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
                                                <tr>
                                                    <td class="web_dialog_title">
                                                        Message
                                                    </td>
                                                    <td class="web_dialog_title align_right">
                                                        <a href="#" id="btnClose">Close</a>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="padding-left: 15px;">
                                                        <div id="brands">
                                                            <%#Eval("Message")%></a>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align: center;">
                                                        <input id="btnSubmit" type="button" value="Submit" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                </ItemTemplate>
                                <HeaderStyle Width="7%" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <%#Eval("Name")%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" />
                                <HeaderStyle Width="11%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Email" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="13%">
                                <ItemTemplate>
                                    <a href="mailto:<%#Eval("Email")%>" class="EmailLink">
                                        <%#Eval("Email")%></a>
                                </ItemTemplate>
                                <HeaderStyle Width="13%" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Phone" HeaderStyle-HorizontalAlign="center" HeaderStyle-Width="7%">
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Width="40px" />
                                <ItemTemplate>
                                    <%#Eval("Phone")%>
                                </ItemTemplate>
                                <HeaderStyle Width="8%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Status" HeaderStyle-HorizontalAlign="center" HeaderStyle-Width="7%">
                                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Width="40px" />
                                <ItemTemplate>
                                    <%#Eval("Subject")%>
                                </ItemTemplate>
                                <HeaderStyle Width="13%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="7%">
                                <ItemTemplate>
                                    <asp:LinkButton CommandName="Delete" CommandArgument='<%#Eval("ContactID") %>' runat="server"
                                        ID="lnkbtnDelete"><img src="Images/delete.gif" border="0" alt='Click to Delete this Entry' title='Click to Delete this Entry' />
                                    </asp:LinkButton>
                                </ItemTemplate>
                                <HeaderStyle Width="7%" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                        <HeaderStyle Height="30px" BackColor="#3E3050" Font-Bold="True" ForeColor="#ffffff" />
                        <PagerStyle ForeColor="Black" BackColor="#C6C3C6" HorizontalAlign="Right" />
                        <RowStyle Height="25px" BackColor="#DEDFDE" ForeColor="Black" />
                        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="#594B9C" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#33276A" />
                    </asp:GridView>

Here is the Css used for Pop Up

.web_dialog_overlay
{
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #000000;
    opacity: .15;
    filter: alpha(opacity=15);
    -moz-opacity: .15;
    z-index: 101;
    display: none;
}
.web_dialog
{
    display: none;
    position: fixed;
    width: 380px;
    height: 200px;
    top: 50%;
    left: 50%;
    margin-left: -190px;
    margin-top: -100px;
    background-color: #ffffff;
    border: 2px solid #336699;
    padding: 0px;
    z-index: 102;
    font-family: Verdana;
    font-size: 10pt;
}
.web_dialog_title
{
    border-bottom: solid 2px #336699;
    background-color: #336699;
    padding: 4px;
    color: White;
    font-weight: bold;
}
.web_dialog_title a
{
    color: White;
    text-decoration: none;
}
.align_right
{
    text-align: right;
}

And here is the jQuery code for pop up:

$(document).ready(function () {

$(function () {
    $('input[id*=hello]').click(function () {
        ShowDialog(true);
        e.preventDefault();
        return false;
    });
});


$('[id$=btnShowModal]').live('click', function (e) {
    ShowDialog(true);
    e.preventDefault();

});

$("#btnClose").click(function (e) {
    HideDialog();
    e.preventDefault();
});

$("#btnSubmit").click(function (e) {
    var brand = $("#brands input:radio:checked").val();
    $("#output").html("<b>Your favorite mobile brand: </b>" + brand);
    HideDialog();
    e.preventDefault();
});
});
function ShowDialog(modal) {
    $("#overlay").show();
    $("#dialog").fadeIn(300);
    if (modal) {
        $("#overlay").unbind("click");
    } else {
        $("#overlay").click(function (e) {
            HideDialog();
        });
    }
}

function HideDialog() {
    $("#overlay").hide();
    $("#dialog").fadeOut(300);
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:44:39+00:00Added an answer on June 18, 2026 at 11:44 am

    Made a silly mistake :

                            <asp:GridView ID="gvContactUs" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            DataKeyNames="ContactID" Width="100%" CellPadding="3" CellSpacing="1" OnPageIndexChanging="gvContactUs_PageIndexChanging"
                            OnRowCommand="gvContactUs_RowCommand" OnRowDataBound="gvContactUs_RowDataBound"
                            OnRowDeleting="gvContactUs_RowDeleting" OnSorting="gvContactUs_Sorting" AllowPaging="True"
                            BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" GridLines="None">
                            <Columns>
                                <asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="3%">
                                    <ItemTemplate>
                                        <asp:Button Text="text" ID="hello" runat="server" />
                                        <div>
                                            <div id="overlay" class="web_dialog_overlay">
                                            </div>
                                            <div id="dialog" class="web_dialog">
                                                <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
                                                    <tr>
                                                        <td class="web_dialog_title">
                                                            Message
                                                        </td>
                                                        <td class="web_dialog_title align_right">
                                                            <a href="#" id="btnClose">Close</a>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" style="padding-left: 15px;">
                                                            <div id="brands">
                                                                <%#Eval("Message")%></a>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" style="text-align: center;">
                                                            <input id="btnSubmit" type="button" value="Submit" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        **</div>**
                                    </ItemTemplate>
                                    <HeaderStyle Width="7%" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left">
                                    <ItemTemplate>
                                        <%#Eval("Name")%>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle Width="11%" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Email" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="13%">
                                    <ItemTemplate>
                                        <a href="mailto:<%#Eval("Email")%>" class="EmailLink">
                                            <%#Eval("Email")%></a>
                                    </ItemTemplate>
                                    <HeaderStyle Width="13%" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Phone" HeaderStyle-HorizontalAlign="center" HeaderStyle-Width="7%">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                    <ItemTemplate>
                                        <%#Eval("Phone")%>
                                    </ItemTemplate>
                                    <HeaderStyle Width="8%" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Status" HeaderStyle-HorizontalAlign="center" HeaderStyle-Width="7%">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                    <ItemTemplate>
                                        <%#Eval("Subject")%>
                                    </ItemTemplate>
                                    <HeaderStyle Width="13%" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="7%">
                                    <ItemTemplate>
                                        <asp:LinkButton CommandName="Delete" CommandArgument='<%#Eval("ContactID") %>' runat="server"
                                            ID="lnkbtnDelete"><img src="Images/delete.gif" border="0" alt='Click to Delete this Entry' title='Click to Delete this Entry' />
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                    <HeaderStyle Width="7%" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                            <HeaderStyle Height="30px" BackColor="#3E3050" Font-Bold="True" ForeColor="#ffffff" />
                            <PagerStyle ForeColor="Black" BackColor="#C6C3C6" HorizontalAlign="Right" />
                            <RowStyle Height="25px" BackColor="#DEDFDE" ForeColor="Black" />
                            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                            <SortedAscendingCellStyle BackColor="#F1F1F1" />
                            <SortedAscendingHeaderStyle BackColor="#594B9C" />
                            <SortedDescendingCellStyle BackColor="#CAC9C9" />
                            <SortedDescendingHeaderStyle BackColor="#33276A" />
                        </asp:GridView>
    

    Forgot to close a div and in jquery code there is a small mistake that is :

     $(function () {
        $('input[id*=hello]').click(function (**e**) {
            ShowDialog(true);
            e.preventDefault();
            return false;
        });
    });
    

    e was missed. by the way thanks all…………. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button inside of a gridview's template field. Onclick i want to
I have a button inside my <ItemTemplate> in GridView and I want to call
I have a input button inside my gridview. I am capturing the button's click
I have a gridview with textbox inside I want to get value of this
How to apply textbox blank validation on button click inside gridview in javascript?I have
I have a gridview inside a div.. I want to scroll to top of
I have a dropdownlist inside the gridview. Now i want when i click on
I am using DevExpress gridview that have a command button inside. I want to
I have a TemplateField column in a gridview with a button inside of it.
I have a gridview and I have a button on it.I want, if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.