Click here to Skip to main content
15,063,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width: 100%">
        <tr>
            <td>
                <br />
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                 
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <contenttemplate>
                        <asp:GridView ID="GridView1" runat="server" 
    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
    onrowdatabound="GridView1_RowDataBound" Width="244px">
                            <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:BoundField DataField="le_yn" HeaderText="le_yn" 
            SortExpression="le_yn" />
                                <asp:BoundField DataField="dd_yn" HeaderText="dd_yn" 
            SortExpression="dd_yn" />
                            </columns>
                            <emptydatatemplate>
                                <asp:LinkButton ID="LinkButton11" runat="server" 
            Font-Size="X-Large" Font-Underline="False" onclick="LinkButton1_Click ">+
                                <asp:Panel ID="Panel3" runat="server" Height="127px" 
            Visible="False">
                                    <asp:GridView ID="GridView2" runat="server" 
                AutoGenerateColumns="False" DataSourceID="SqlDataSource2">
                                        <columns>
                                            <asp:BoundField DataField="req_id" HeaderText="req_id" 
                        InsertVisible="False" ReadOnly="True" SortExpression="req_id" />
                                            <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="date" HeaderText="date" 
                        SortExpression="date" />
                                            <asp:BoundField DataField="no_deo" HeaderText="no_deo" 
                        SortExpression="no_deo" />
                                            <asp:BoundField DataField="no_mon" HeaderText="no_mon" 
                        SortExpression="no_mon" />
                                        </columns>
                                    
                                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT * FROM [request_dept] WHERE ([l_no] = @l_no)">
                                        <SelectParameters>
                                            <asp:Parameter Name="l_no" Type="String" />
                                        </SelectParameters>
                                    
                                
                            </emptydatatemplate>
                        
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                            SelectCommand="SELECT * FROM [viewyn]">
                    </contenttemplate>
                
                
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
                
               
            </td>
        </tr>
    </table>

public partial class trygrid : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        
        
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            SqlDataSource s = (SqlDataSource)e.Row.FindControl("SqlDataSource2");
            s.SelectParameters[0].DefaultValue = e.Row.Cells[1].Text;
        }

    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton l_btn =   (LinkButton)sender;
        GridViewRow gvr = (GridViewRow)l_btn.NamingContainer;
    Panel p1 =   (Panel)gvr.FindControl("Panel3");
    LinkButton lb1 =   (LinkButton)gvr.FindControl("LinkButton1");
    if (p1.Visible == false)
    {
        p1.Visible = true;
        lb1.Text = "-";
    }
    else if (p1.Visible == true)
    {
        p1.Visible = false;
        lb1.Text = "+";
    }

    GridView gv2 =   (GridView)l_btn.FindControl("GridView2");
    gv2.DataBind();



    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
}
Posted
Updated 3-Dec-11 1:10am
v2

1 solution

   
Comments
thatraja 3-Dec-11 8:36am
   
5!
Abhinav S 3-Dec-11 8:46am
   
Thank you thatraja.

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