-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: BalajiKrishnan
Message 1 in Discussion

Hi All, I am using a datagrid to display the records........   Now I need to edit the 
values in the grid.........   For Example in the below grid the value of the 
Year(first row) will be changed to 2000 from 1987 (I can do this)   Now when I press 
the update button i am printing the textbox value.......i am not getting the edited 
value(instead 
 i get the same value(1987)   The logic i used to capture the current text box is shon 
below........   pls review the code and give me the solution.....   DATAGRID        
Update ID ExchangeName  Year    Update Cancel  11  TEST1  1987   Update Cancel  12  
TEST2  1978     do.aspx.vb Sub MyDataGrid_Update(ByVal sender As Object, ByVal e As 
DataGridCommandEventArgs)  Dim intRNum = CInt(e.Item.ItemIndex)
 Dim IntItem As Integer
 Dim Cols As String() = {"ID", "ExchangeName", "Year"}  For IntItem = 0 To 2
 
 Dim CurrentTextBox As System.Web.UI.WebControls.TextBox  CurrentTextBox = 
e.Item.FindControl("edit_" & Cols(IntItem))
 
 Dim ColValue As String = CurrentTextBox.Text
 
 Response.Write(ColValue)
 Response.Write("<br>") End Sub
          do.aspx  <asp:DataGrid id="MOL_ECO_DG" style="Z-INDEX: 101; LEFT: 31px; 
POSITION: absolute; TOP: 195px" runat="server" OnEditCommand="MyDataGrid_Edit" 
OnCancelCommand="MyDataGrid_Cancel" OnUpdateCommand="MyDataGrid_Update" 
DataKeyField="ExchangeID" AutoGenerateColumns="False">   <Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="Edit" 
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> <asp:TemplateColumn 
SortExpression="ExchangeID" HeaderText="ExchangeID">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ExchangeID") 
%>' ID="ExchangeID" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="edit_ID" Text='<%# DataBinder.Eval(Container.DataItem, 
"ExchangeID") %>' Enabled = False/>
</EditItemTemplate>
</asp:TemplateColumn> <asp:TemplateColumn SortExpression="ExchangeName" 
HeaderText="ExchangeName">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, 
"ExchangeName") %>' ID="ExchangeName" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="edit_ExchangeName" Text='<%# 
DataBinder.Eval(Container.DataItem, "ExchangeName") %>' />
</EditItemTemplate>
</asp:TemplateColumn> <asp:TemplateColumn SortExpression="Year" HeaderText="Year">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Year") %>' 
ID="Year" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="edit_Year" Text='<%# 
DataBinder.Eval(Container.DataItem, "Year") %>'  />
</EditItemTemplate>
</asp:TemplateColumn>
<Columns>
    

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to