Click here to Skip to main content
16,005,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Clikable gridview

Dear All,

I want to populate dashboard.
Currently dashboard populates Count of cases in all queues.
What i want is.. when user clicks on count, it should populate all records belongs to that count.

Dashboard gets populated based on some filters so main gridview columns are dynamic. now i want those columns to be clickable. Once user clicks count it should populate records belong to that column.

Please check code i wrote so far..


This is main Grid
ASP.NET
 <table width="95%" align="center">
        <tr>
            <td>
                <div style="width: 99%; height: 100%; overflow-x: scroll; overflow-y: scroll; scrollbar-arrow-color: blue;
                    scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color: #888888">
<%--                    <asp:GridView ID="datag" runat="server" AllowPaging="True" CellPadding="4" 
                        EnableModelValidation="True" ForeColor="#333333" GridLines="None" 
                        Width="100%" onrowdatabound="datag_RowDataBound">
                        <AlternatingRowStyle BackColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#B1D5FC" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    </asp:GridView>--%>
                    <asp:DataGrid ID="datag" runat="server" SkinID="DataGrid" Height="10px" width="100%"
                            AllowPaging="True" PageSize="7" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" onitemdatabound="datag_ItemDataBound">
                            <AlternatingItemStyle BackColor="White" />
                            <EditItemStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <ItemStyle BackColor="#EFF3FB" />
                            <PagerStyle Font-Size="XX-Small" ForeColor="White" BackColor="#2461BF" 
                                Mode="NumericPages" HorizontalAlign="Center">
                            </PagerStyle>
                            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        </asp:DataGrid>
                </div>
            </td>
        </tr>
    </table>


Code to Populate Data in DataGrid

C#
protected void GetDashboard()
   {
       SqlParameter[] sqlparam = new SqlParameter[8];
       sqlparam[0] = new SqlParameter("@Project_Code", "PE081507");
       sqlparam[1] = new SqlParameter("@User_Level", Convert.ToString(Session["UserLevel"]));
       sqlparam[2] = new SqlParameter("@User_Name", Convert.ToString(Session["User"]));
       sqlparam[3] = new SqlParameter("@DocTypeCode", Convert.ToString(ViewState["InvTypeFilter"]));
       sqlparam[4] = new SqlParameter("@QueueCode", Convert.ToString(ViewState["QueueFilter"]));
       sqlparam[5] = new SqlParameter("@Header", "");
       sqlparam[5].Direction = ParameterDirection.Output;
       sqlparam[6] = new SqlParameter("@ResponseId","");
       sqlparam[6].Direction = ParameterDirection.Output;
       sqlparam[7] = new SqlParameter("@Message","");
       sqlparam[7].Direction = ParameterDirection.Output;

       datag.DataSource = SqlDBHelper.ExecuteTable(CommandType.StoredProcedure, "usp_Web_GetDashBoard_filter", sqlparam, "PEARSON");
       datag.DataBind();
   }

Please help me for making cells in my grid clickable.


Thanks in Advance.
Posted

1 solution

 
Share this answer
 

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