Link to home
Start Free TrialLog in
Avatar of lakshmidurga
lakshmidurga

asked on

get data in UpdateCommand Datagrid

Hi all,

Here is how i declared my datagrid.
When i click on edit,it is converting the cells to editable textboxes.When i click on update it is raising GridLenders_UpdateCommand

I am trying to get the values changed in my event.But they are comming as empty strings.

I tried with e.items.cells(1).text

Dim txtbox As New TextBox
        txtbox = CType(e.Item.FindControl(e.items.cells(1).text), TextBox)
        MsgBox(txtbox.Text)

But i am getting "" values even there is data .
How to retrive data in this updatecommand  to update my database
<asp:DataGrid ID="gridLenders" runat="server" DataKeyField="id" BorderStyle="Ridge" GridLines="None" BorderWidth="2px" BorderColor="White" BackColor="White" CellPadding= "3" CellSpacing="1" AllowSorting="True" 
			  PagerStyle-HorizontalAlign = "Center" HorizontalAlign="Left" OnEditCommand="gridLenders_EditCommand" OnCancelCommand= "gridLenders_CancelCommand"  OnUpdateCommand="gridLenders_UpdateCommand"
			    OnDeleteCommand= "gridLenders_DeleteCommand" AutoGenerateColumns="false" width="96%" >
 
          
 
        <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
 
        <HeaderStyle Font-Bold="True" ForeColor="#FFFFFF" 
 
                  BackColor="#A53A6A"></HeaderStyle>
 
       <FooterStyle BackColor="beige" />
       <Columns>
 
        <asp:BoundColumn DataField="Id" HeaderText="ID"  Visible ="false" >
 
          <ItemStyle BackColor="graytext" />
 
          <HeaderStyle BackColor="graytext" />
 
          </asp:BoundColumn>
 
         
 
          <asp:BoundColumn DataField="Lender" HeaderText="Lender">
 
          <ItemStyle BackColor="GhostWhite" />
 
          </asp:BoundColumn>
 
                  
 
          <asp:BoundColumn DataField="AccreditationId" HeaderText="AccreditationId">
 
          <ItemStyle BackColor="GhostWhite" />
 
          </asp:BoundColumn>
 
        
          <asp:EditCommandColumn CancelText="Cancel" EditText="Edit"  
 
                         UpdateText="Update" HeaderText="Modify">
 
          <ItemStyle BackColor="GhostWhite" />
 
          </asp:EditCommandColumn>
 <asp:ButtonColumn CommandName="Delete" HeaderText="Delete" Text="Delete">
 
          <ItemStyle BackColor="GhostWhite" />
 
          </asp:ButtonColumn>
 </Columns>
 
   </asp:DataGrid>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of theplonk
theplonk
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial