使gridview单元格可单击。

问题描述:

Clikable gridview



亲爱的所有人,



我想要填充仪表板。

目前仪表板填充所有队列中的案例数。

我想要的是......当用户点击计数时,它应该填充属于该计数的所有记录。



基于某些过滤器填充仪表板,因此主要的gridview列是动态的。现在我希望这些列可以点击。一旦用户点击计数,它应该填充属于该列的记录。



请检查我到目前为止写的代码..





这是主网格

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

 <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>





在DataGrid中填充数据的代码





Code to Populate Data in DataGrid

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.

您好b $ b

快速搜索codeproject返回以下内容:



请查看是否有任何链接可以帮助你:)



在asp.net的gridview单击格式上创建活动 [ ^ ]



带有单元格点击事件的扩展ASP.NET GridView [ ^ ]



在ASP.NET中编辑单个GridView单元格 [ ^ ]



http://www.vbforums.com/showthread.php?588297-Click-event-in-cell-of-a-GridView [ ^ ]
Hi
Quick search on codeproject returned the following:

PLease see if any of these links help you out :)

Creating event on cell click of gridview in asp.net[^]

Extended ASP.NET GridView with cell click events[^]

Edit Individual GridView Cells in ASP.NET[^]

http://www.vbforums.com/showthread.php?588297-Click-event-in-cell-of-a-GridView[^]