G
Guest
How do I take my GridView and create a function that will update -all-
checkbox values for the submit button's OnClick event? I have posted both my
SQLDataSource and my GridView below:
<asp:SqlDataSource
ID="ds_dashboard"
runat="server"
ConnectionString="<%$ ConnectionStringsashboardConn %>"
SelectCommand="Get_Customer_DashboardGraphs"
SelectCommandType="StoredProcedure"
UpdateCommand="Update_Customer_DashboardGraphs"
UpdateCommandType="StoredProcedure"<UpdateParameters>
<asparameter Name="CustomerID" Type="Int32" />
<asparameter Name="CurrentMonthCollections"
Type="Int16" />
<asparameter Name="RevenueByMonth" Type="Int16" />
<asparameter Name="PDCsCCsMonthly" Type="Int16" />
<asparameter Name="RevenueByClient" Type="Int16" />
</UpdateParameters>
</asp:SqlDataSource>
--------------------------------------------------------------------------------------
<table id="Table1" class="main_table" cellspacing="0" cellpadding="2"
border="1" runat="server">
<tr>
<td class="main_header">Filter Tool</td>
</tr>
<tr><td colspan="2"><br />For month: <asp:Label runat="server"
id="lblCurrentMonth" /><br /><br /></td></tr>
<tr><td>
<asp:GridView
ID="gv_dashboard"
runat="server"
AutoGenerateColumns="False"
AutoGenerateEditButton = "TRUE"
DataSourceID="ds_dashboard"
CellPadding="4"
ForeColor="#333333"
ShowFooter="True"
GridLines="None"
CssClass="FormatFont">
<Columns>
<asp:TemplateField HeaderText="Cust #"
SortExpression="CustomerID">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:Label runat="server" id="lblCustomerID"
Text='<%# Bind("CustomerID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Current Month Collections"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="CurrentMonthCollections" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revenue By Month"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="RevenueByMonth" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PDCs & CCS Monthly"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="PMonthly" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revenue By Client"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="RevenueByClient" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#DDDDDD" />
<SelectedRowStyle BackColor="#DDDDDD" Font-Bold="True"
ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</td></tr>
<tr>
<td align="right">
<asp:Button CssClass="submitbutton" Text="Update" ID="Button1"
OnClick="UpdateFees" Runat="server" />
</td>
</tr>
</table>
checkbox values for the submit button's OnClick event? I have posted both my
SQLDataSource and my GridView below:
<asp:SqlDataSource
ID="ds_dashboard"
runat="server"
ConnectionString="<%$ ConnectionStringsashboardConn %>"
SelectCommand="Get_Customer_DashboardGraphs"
SelectCommandType="StoredProcedure"
UpdateCommand="Update_Customer_DashboardGraphs"
UpdateCommandType="StoredProcedure"<UpdateParameters>
<asparameter Name="CustomerID" Type="Int32" />
<asparameter Name="CurrentMonthCollections"
Type="Int16" />
<asparameter Name="RevenueByMonth" Type="Int16" />
<asparameter Name="PDCsCCsMonthly" Type="Int16" />
<asparameter Name="RevenueByClient" Type="Int16" />
</UpdateParameters>
</asp:SqlDataSource>
--------------------------------------------------------------------------------------
<table id="Table1" class="main_table" cellspacing="0" cellpadding="2"
border="1" runat="server">
<tr>
<td class="main_header">Filter Tool</td>
</tr>
<tr><td colspan="2"><br />For month: <asp:Label runat="server"
id="lblCurrentMonth" /><br /><br /></td></tr>
<tr><td>
<asp:GridView
ID="gv_dashboard"
runat="server"
AutoGenerateColumns="False"
AutoGenerateEditButton = "TRUE"
DataSourceID="ds_dashboard"
CellPadding="4"
ForeColor="#333333"
ShowFooter="True"
GridLines="None"
CssClass="FormatFont">
<Columns>
<asp:TemplateField HeaderText="Cust #"
SortExpression="CustomerID">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:Label runat="server" id="lblCustomerID"
Text='<%# Bind("CustomerID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Current Month Collections"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="CurrentMonthCollections" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revenue By Month"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="RevenueByMonth" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PDCs & CCS Monthly"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="PMonthly" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Revenue By Client"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:checkboxfield runat="server"
datafield="RevenueByClient" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#DDDDDD" />
<SelectedRowStyle BackColor="#DDDDDD" Font-Bold="True"
ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</td></tr>
<tr>
<td align="right">
<asp:Button CssClass="submitbutton" Text="Update" ID="Button1"
OnClick="UpdateFees" Runat="server" />
</td>
</tr>
</table>