GridView复选框检查限制和检索数据 [英] GridView Checkbox Check Limit & Retrieve Data

查看:79
本文介绍了GridView复选框检查限制和检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有附加数据源的gridview

I have a gridview with an attached datasource

in a multiview; view 2. I want to make the checking done within that view 2 and transfer the contents to view 3 as summary. One of my business logic states that only a maximum number of 3 child can be selected in the gridView in view2. I would want to know which event i should be using under gridview to let this work (Checking of checkbox and saving data. After google-ing for like 1-2 hours all of the codes i've found are either not what im looking for or too complicated =.=


This is my gridview html
<pre><asp:GridView ID="Gv_Children" runat="server" AllowPaging="True"
                                AllowSorting="True" AutoGenerateColumns="False" BackColor="#DEBA84"
                                BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3"
                                CellSpacing="2" DataSourceID="DataSourceGuardian"
                                ShowHeaderWhenEmpty="True"
                                style="margin-right: 1px" ViewStateMode="Enabled" Width="255px"
                                &gt;
                                &lt;Columns&gt;
                                    &lt;asp:BoundField DataField="GuardianIC" HeaderText="IC" ReadOnly="True"
                                        SortExpression="GuardianIC" /&gt;
                                    &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
                                    &lt;asp:TemplateField HeaderText="Select"&gt;
                                            &lt;ItemTemplate&gt;
                                                 &lt;asp:CheckBox ID="chkSelect" runat="server" /&gt;
                                            &lt;/ItemTemplate&gt;
                                                &lt;HeaderTemplate&gt;
                                                &lt;/HeaderTemplate&gt;
                                        &lt;/asp:TemplateField&gt;
                                &lt;/Columns&gt;
                                &lt;EmptyDataRowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
                                &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
                                &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
                                &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
                                &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
                                &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;
                                &lt;SortedAscendingCellStyle BackColor="#FFF1D4" /&gt;
                                &lt;SortedAscendingHeaderStyle BackColor="#B95C30" /&gt;
                                &lt;SortedDescendingCellStyle BackColor="#F1E5CE" /&gt;
                                &lt;SortedDescendingHeaderStyle BackColor="#93451F" /&gt;
                            &lt;/asp:GridView></pre>

推荐答案

Try this
plese check given link .
i hope helpful for you


这篇关于GridView复选框检查限制和检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆