programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Thursday, February 19, 2015

ASP.Net DataList Item in jQuery Dialog Modal popup on button click

ASP.Net DataList Item in jQuery Dialog Modal popup on button click:

DataList Item in jQuery Dialog Modal popup:

<html xmlns="">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" src=""></script>
    <script src="" type="text/javascript"></script>
    <link href=""
        rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $("[id*=lnkSelect]").live("click", function () {
            $("#item").html($("[id*=lblItem]", $(this).closest("tr")).html());
            $("#price").html($("[id*=lblPrice]", $(this).closest("tr")).html());
                title: "Selected Row",
                buttons: {
                    Ok: function () {
            return false;
    <form id="form1" runat="server">
    <asp:DataList ID="DataList1" runat="server">
            <asp:Label ID="lblItem" runat="server" Text='<%# Eval("Item") %>'></asp:Label><br />
            <asp:Label ID="lblPrice" runat="server" Text='<%# Eval("Price") %>'></asp:Label><br />
            <asp:LinkButton ID="lnkSelected" runat="server" Text="Select"></asp:LinkButton>
    <div id="dialog" style="display: none">
        Item:<span id="item"></span><br />
        Price:<span id="price"></span>

How to Display items in PopUp from DataList Button Click in

page.aspx.cs C# code for bind datalist:

protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Item"), new DataColumn("Price") });
            dt.Rows.Add("Shirt", 0);
            dt.Rows.Add("Football", 1000);
            dt.Rows.Add("Bat", 500);
            DataList1.DataSource = dt;


No comments:

Post a Comment