![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've got a asp.net 2.0 gridview with a list of orders. I want to add a column with a checkbox (simple enough) and make it so that when I click a submit button, the postback sets the status on each of the records with a checkbox so that they are completed. So in my gridview, I have the following attribute: DataKeyNames="order_id" and the following code for the status: asp:TemplateField HeaderText="Item Status" SortExpression="status_name" EditItemTemplate asp ropDownList ID="ddStatus" runat="server"DataSourceID="dsStatus" DataTextField="status_name" DataValueField="status_id" SelectedValue='<%# Bind("order_status_id") %>' /asp ropDownList/EditItemTemplate ItemTemplate asp:Label ID="lblStatus" runat="server" Text='<%# Bind("status_name") %>'></asp:Label /ItemTemplate /asp:TemplateField and have added a checkbox column: asp:CheckBoxField HeaderText="Close" / and outside the gridview I added: asp:LinkButton ID="btnCloseItems" runat="server" CommandName="closeSelected">Close Selected</asp:LinkButton then in my page load method, I have: if (IsPostBack) { } but where do I go from here? I feel comfortable writing a method that changes the status for the records, but how do I go about looping through the records in the postback and identifying the value of the checkbox and order_id? Is there a standard asp.net way of doing what I'm trying to do, or is writing code to handle this the best approach? In any case, any help to accomplish my goal would be much appreciated. Marc |
#3
| |||
| |||
|
|
all you need to do is: read this tutorial ![]() http://www.gridviewguy.com/ArticleDe...?articleID=219 Bruno Alexandre Stroby, Danmark "a Portuguese in Denmark" "archuleta37" <archuleta37 (AT) discussions (DOT) microsoft.com> wrote in message news:01B5970F-06BB-4074-A8B4-AD7DBA70E0A7 (AT) microsoft (DOT) com... I've got a asp.net 2.0 gridview with a list of orders. I want to add a column with a checkbox (simple enough) and make it so that when I click a submit button, the postback sets the status on each of the records with a checkbox so that they are completed. So in my gridview, I have the following attribute: DataKeyNames="order_id" and the following code for the status: asp:TemplateField HeaderText="Item Status" SortExpression="status_name" EditItemTemplate asp ropDownList ID="ddStatus" runat="server"DataSourceID="dsStatus" DataTextField="status_name" DataValueField="status_id" SelectedValue='<%# Bind("order_status_id") %>' /asp ropDownList/EditItemTemplate ItemTemplate asp:Label ID="lblStatus" runat="server" Text='<%# Bind("status_name") %>'></asp:Label /ItemTemplate /asp:TemplateField and have added a checkbox column: asp:CheckBoxField HeaderText="Close" / and outside the gridview I added: asp:LinkButton ID="btnCloseItems" runat="server" CommandName="closeSelected">Close Selected</asp:LinkButton then in my page load method, I have: if (IsPostBack) { } but where do I go from here? I feel comfortable writing a method that changes the status for the records, but how do I go about looping through the records in the postback and identifying the value of the checkbox and order_id? Is there a standard asp.net way of doing what I'm trying to do, or is writing code to handle this the best approach? In any case, any help to accomplish my goal would be much appreciated. Marc |
#4
| |||
| |||
|
|
all you need to do is: read this tutorial ![]() http://www.gridviewguy.com/ArticleDe...?articleID=219 Bruno Alexandre Stroby, Danmark "a Portuguese in Denmark" "archuleta37" <archuleta37 (AT) discussions (DOT) microsoft.com> wrote in message news:01B5970F-06BB-4074-A8B4-AD7DBA70E0A7 (AT) microsoft (DOT) com... I've got a asp.net 2.0 gridview with a list of orders. I want to add a column with a checkbox (simple enough) and make it so that when I click a submit button, the postback sets the status on each of the records with a checkbox so that they are completed. So in my gridview, I have the following attribute: DataKeyNames="order_id" and the following code for the status: asp:TemplateField HeaderText="Item Status" SortExpression="status_name" EditItemTemplate asp ropDownList ID="ddStatus" runat="server"DataSourceID="dsStatus" DataTextField="status_name" DataValueField="status_id" SelectedValue='<%# Bind("order_status_id") %>' /asp ropDownList/EditItemTemplate ItemTemplate asp:Label ID="lblStatus" runat="server" Text='<%# Bind("status_name") %>'></asp:Label /ItemTemplate /asp:TemplateField and have added a checkbox column: asp:CheckBoxField HeaderText="Close" / and outside the gridview I added: asp:LinkButton ID="btnCloseItems" runat="server" CommandName="closeSelected">Close Selected</asp:LinkButton then in my page load method, I have: if (IsPostBack) { } but where do I go from here? I feel comfortable writing a method that changes the status for the records, but how do I go about looping through the records in the postback and identifying the value of the checkbox and order_id? Is there a standard asp.net way of doing what I'm trying to do, or is writing code to handle this the best approach? In any case, any help to accomplish my goal would be much appreciated. Marc |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |