<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Private Sub lnkCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Retrieve Customer ID Dim lnkCustomerID As LinkButton = TryCast(sender, LinkButton) Dim strCustomerID As String = lnkCustomerID.Text 'Create sql connection and fetch data from database based on CustomerID Dim strConnectionString As String = ConfigurationManager.ConnectionStrings("NorthwndConnectionString").ConnectionString Dim strSelect As String = "SELECT CompanyName, ContactName, Address FROM Customers WHERE CustomerID = @customerID" Dim sqlCon As New SqlConnection() sqlCon.ConnectionString = strConnectionString Dim cmdCustomerDetails As New SqlCommand() cmdCustomerDetails.Connection = sqlCon cmdCustomerDetails.CommandType = System.Data.CommandType.Text cmdCustomerDetails.CommandText = strSelect cmdCustomerDetails.Parameters.AddWithValue("@customerID", strCustomerID) sqlCon.Open() 'Create DataReader to read the record Dim dReader As SqlDataReader = cmdCustomerDetails.ExecuteReader() GridView2.DataSource = dReader GridView2.DataBind() sqlCon.Close() modalPopUpExtender1.Show() End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <style type="text/css"> body { font: normal 12px auto "Trebuchet MS", Verdana; background-color: #ffffff; color: #4f6b72; } .popUpStyle { font: normal 11px auto "Trebuchet MS", Verdana; background-color: #ffffff; color: #4f6b72; padding:6px; } .drag { background-color: #dddddd; cursor: move; border:solid 1px gray ; } </style> </head> <body> <form id="form1" runat="server"> <div> <AjaxToolkit:ToolkitScriptManager ID="scriptManager" runat="server"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="OrderID" DataSourceID="SqlDataSource1" Width="650px" ShowHeader="false" PageSize="5"> <columns> <asp:BoundField DataField="OrderID" HeaderText="OrderID"/> <asp:TemplateField HeaderText="CustomerID"> <itemtemplate> <asp:LinkButton runat="server" ID="lnkCustomer" Text='<%#Eval("CustomerID") %>' onclick="lnkCustomer_Click"> </itemtemplate> <asp:BoundField DataField="OrderDate" HeaderText="OrderDate"/> <asp:BoundField DataField="ShippedDate" HeaderText="ShippedDate"/> <asp:BoundField DataField="ShipCity" HeaderText="ShipCity"/> <asp:BoundField DataField="ShipCountry" HeaderText="ShipCountry"/> </columns> <asp:Button runat="server" ID="btnModalPopUp" style="display:none"/> <AjaxToolkit:ModalPopupExtender ID="modalPopUpExtender1" runat="server" TargetControlID="btnModalPopUp" PopupControlID="pnlPopUp" BackgroundCssClass="modalBackground" OkControlID="btnOk" X="20" Y="100"> <asp:Panel runat="Server" ID="pnlPopUp"> <asp:GridView ID="GridView2" runat="server"> <table> <tr> <td align="center"> <asp:Button ID="btnCancel" runat="server" Text="Ok" /> </td> </tr> </table> </contenttemplate> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwndConnectionString %>" SelectCommand="SELECT [OrderID], [CustomerID], [OrderDate], [ShippedDate], [ShipCity], [ShipCountry] FROM [Orders]"> </div> </form> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)