You must Sign In to post a response.
  • Category: ASP.NET

    How To Display Gridview In Right Side When I Click The Dropdownlist

    My design as follows

    Branch ddlbranch(dropdownlist)

    One gridview (gvResult) gridview name

    Type ddlfeedbacktype (dropdownlist)
    Subject txtsubject(textbox)
    Comments txtcomments(textbox)

    Submit(Button)

    When i click ddlbranch (dropdownlist) i want to show the gridview (gvResult)
    Gridview is displaying no problem.

    But i want to display the Gridview (gvResult) in righ side. when i click the ddlbranch (dropdownlist).

    My source as follows

    <asp:Panel ID="ff" runat="server" Height="451px" BackColor="Bisque"
    BorderColor="BlanchedAlmond" BorderStyle="Groove" Width="931px">

    <table style="height: 165px; width: 301px">

    <tr>
    <td>
    <asp:Label ID="lblbranch" runat="server" Text="Branch"></asp:Label>
    <asp:DropDownList ID="ddlbranch" runat="server"
    onselectedindexchanged="ddlbranch_SelectedIndexChanged">
    <asp:ListItem>KALPAKKAM</asp:ListItem>
    <asp:ListItem>KILPAUK</asp:ListItem>
    <asp:ListItem>TIDELPARK</asp:ListItem>
    </asp:DropDownList>

    <asp:Panel ID="pnlresult" runat="server">

    <asp:GridView ID="gvResult" runat="server" BackColor="LightGoldenrodYellow"
    BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black"
    GridLines="None">
    <AlternatingRowStyle BackColor="PaleGoldenrod" />
    <FooterStyle BackColor="Tan" />
    <HeaderStyle BackColor="Tan" Font-Bold="True" />
    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
    HorizontalAlign="Center" />

    <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    <SortedAscendingCellStyle BackColor="#FAFAE7" />
    <SortedAscendingHeaderStyle BackColor="#DAC09E" />
    <SortedDescendingCellStyle BackColor="#E1DB9C" />
    <SortedDescendingHeaderStyle BackColor="#C2A47B" />
    </asp:GridView>

    </asp:Panel>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="lblfeedbacktype" runat="server" Text="Type"></asp:Label>
    <asp:DropDownList ID="ddlfeedbacktype" runat="server">
    </asp:DropDownList>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="lblsubject" runat="server" Text="Subject"></asp:Label>
    <asp:TextBox ID="txtsubject" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>

    <td>
    <asp:Label ID="lblcomments" runat="server" Text="Comments"></asp:Label>
    <asp:TextBox ID="txtcomments" runat="server"></asp:TextBox>
    </td>
    </tr>


    <tr>
    <td>
    <asp:Button ID="btnSave" ForeColor="Blue" runat="server" Text="Submit" BackColor= "SaddleBrown"
    BorderColor="BlanchedAlmond" BorderStyle="Ridge" Width="242px" />
    </td>
    </tr>
    </table>
    </asp:Panel>

    When i click the dropdownlist (ddlbrnach) i want to show the gridview in right side not in below of dropdownlist.
    from my above source what changes i have to made to get correct output.
  • #763087
    Hai Rao,
    In a <td> where you are displaying the label, dropdown and the gridview, you need to create a table inside this <td> and then you can create a row with 3 <td> and then in first <td>, keep the label, in 2nd, keep the dropdown list and in 3rd <td> keep your GridView so that the Grid will display in the same row.
    <td>
    <table>
    <tr>
    <td> label </td>
    <td> dropdownlist </td>
    <td> gridview </td>
    </tr>
    </table>
    </td>
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #763090
    Please try with the following also:-

    <table style="height: 165px; width: 301px">

    <tr>
    <td>
    <asp:Label ID="lblbranch" runat="server" Text="Branch"></asp:Label>
    <asp:DropDownList ID="ddlbranch" runat="server"
    onselectedindexchanged="ddlbranch_SelectedIndexChanged">
    <asp:ListItem>KALPAKKAM</asp:ListItem>
    <asp:ListItem>KILPAUK</asp:ListItem>
    <asp:ListItem>TIDELPARK</asp:ListItem>
    </asp:DropDownList>
    </td>

    <td>
    <asp:Panel ID="pnlresult" runat="server">

    <asp:GridView ID="gvResult" runat="server" BackColor="LightGoldenrodYellow"
    BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black"
    GridLines="None">
    <AlternatingRowStyle BackColor="PaleGoldenrod" />
    <FooterStyle BackColor="Tan" />
    <HeaderStyle BackColor="Tan" Font-Bold="True" />
    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
    HorizontalAlign="Center" />

    <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    <SortedAscendingCellStyle BackColor="#FAFAE7" />
    <SortedAscendingHeaderStyle BackColor="#DAC09E" />
    <SortedDescendingCellStyle BackColor="#E1DB9C" />
    <SortedDescendingHeaderStyle BackColor="#C2A47B" />
    </asp:GridView>

    </asp:Panel>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="lblfeedbacktype" runat="server" Text="Type"></asp:Label>
    <asp:DropDownList ID="ddlfeedbacktype" runat="server">
    </asp:DropDownList>
    </td>
    </tr>
    <tr>
    <td>
    <asp:Label ID="lblsubject" runat="server" Text="Subject"></asp:Label>
    <asp:TextBox ID="txtsubject" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>

    <td>
    <asp:Label ID="lblcomments" runat="server" Text="Comments"></asp:Label>
    <asp:TextBox ID="txtcomments" runat="server"></asp:TextBox>
    </td>
    </tr>


    <tr>
    <td>
    <asp:Button ID="btnSave" ForeColor="Blue" runat="server" Text="Submit" BackColor= "SaddleBrown"
    BorderColor="BlanchedAlmond" BorderStyle="Ridge" Width="242px" />
    </td>
    </tr>
    </table>

    Hopefully it will resolve your problem

  • #763101
    Hi,

    This is so difficult to say that because of this reason it is not working for design issue's. May be because of some other design it may effect or impact. I request you to try by your own, as of my knowledge other than this there is no other solution to achieve your goal. If you need help better to discuss with your team members.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments