<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="last_try.aspx.cs" Inherits="last_try" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" AllowPaging="True" DataSourceID="SqlDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged"
onrowcommand="GridView1_RowCommand" >
<Columns>
<asp:BoundField DataField="l_no" HeaderText="l_no"
SortExpression="l_no" />
<asp:BoundField DataField="nam_dep" HeaderText="nam_dep"
SortExpression="nam_dep" />
<asp:BoundField DataField="no_deo" HeaderText="no_deo"
SortExpression="no_deo" />
<asp:BoundField DataField="no_mon" HeaderText="no_mon"
SortExpression="no_mon" />
<asp:TemplateField HeaderText="le_yn">
<ItemTemplate>
<asp:LinkButton runat="server" ID ="l_no" Text='<%# Eval("le_yn") %>' CommandName="letter" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="dd_yn" HeaderText="dd_yn" SortExpression="dd_yn" />
</Columns>
</asp:GridView>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="btnShowModalPopup"
PopupControlID="divPopUp"
BackgroundCssClass="popUpStyle"
PopupDragHandleControlID="panelDragHandle"
DropShadow="true"> </asp:ModalPopupExtender>
<asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/>
<%--<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
TargetControlID="Button1"
PopupControlID="divPopUp"
BackgroundCssClass="popUpStyle"
PopupDragHandleControlID="panelDragHandle"
DropShadow="true"> </asp:ModalPopupExtender>
<asp:Button runat="server" ID="Button1" style="display:none"/>--%>
<div class="popUpStyle" id="divPopUp" style="display:none;">
<asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag">
</asp:Panel>
<asp:Label runat="server" ID="lblText" Text="letter no: "></asp:Label>
<asp:Label ID="lblCustValue" runat="server"></asp:Label>
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
<asp:Button ID="btnClose" runat="server" Text="Close" />
<br />
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Abcstring %>"
SelectCommand="SELECT * FROM [viewyn]"></asp:SqlDataSource>
<table style="width: 100%">
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</asp:Content>
public void show()
{
ModalPopupExtender1.Show();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "letter")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Label le = (Label)row.Cells[0].FindControl("l_no");
string constr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Abcstring"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM Letter_dept WHERE l_no='" + le.Text + "'", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
GridView2.DataSource = ds.Tables[0];
GridView2.DataBind();
}
con.Close();
show();
}
}