how to get a column value in radgrid on DeleteCommand event

Hi All I have a radgrid like this :

<cc1:RadGridCustomized ID="RadGrid1" runat="server" OnNeedDataSource="RadGridCustomized1_NeedDataSource"
    OnPreRender="RadGridCustomized1_PreRender" OnUpdateCommand="RadGridCustomized1_UpdateCommand"
    OnDeleteCommand="RadGridCustomized1_DeleteCommand" OnInsertCommand="RadGridCustomized1_InsertCommand"
    OnItemCreated="RadGridCustomized1_OnItemCreated">
    <MasterTableView DataKeyNames="ID">
        <Columns>
            <telerik:GridTemplateColumn HeaderText="گروه آزمایش" Visible="false">
                <ItemTemplate>
                    <%# Eval("HSEWaterExamGroupName") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox OnDataBinding="RadGridCustomized1_ccbBinding3" runat="server"
                        ID="cbbHSEWaterExamsBaseGroup">
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="نام ماده/ آزمایش" UniqueName="materialName">
                <ItemTemplate>
                    <%# Eval("HSEWaterExamBaseName") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox OnDataBinding="RadGridCustomized1_ccbBinding4" runat="server"
                        ID="cbbName">
                    </telerik:RadComboBox>
                    <telerik:RadTextBox ID="txtName" Enabled="false" Visible="false" runat="server" >
                  </telerik:RadTextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
    </Columns>
    </MasterTableView>
</cc1:RadGridCustomized>

now i want get the value of column “materialName” in DeleteCommand event. I use this code:

GridDataItem da = e.Item as GridDataItem;
string name = da["materialName"].Text;

or this code:

  name =  RadGrid1.MasterTableView.Items[e.Item.ItemIndex]["materialName"].Text;

but the return value is string empty. plz help me if any one has idea to do this . thanks in advance.



telerik. RadGrid get DataKeyField value in client event

How can i get DataKeyField value in my javascript event OnHierarchyExpanded?

Get Value of hidden column of radgrid telerik in asp.net

I have a radgrid in which I hide Id column. Now I want to get its value on linkbutton click. If column is visible it work fine but it show blank value when it is invisible. my code is protected void

How to get the Telerik RadGrid footer row value?

Using C#, how do I get values from a textbox which is in a RadGrid Footer? I am getting an error in the following code. How do I solve it? TextBox texte=(TextBox)RadGrid1.FooterRow.FindControl(texte

How can I assign one value to column by js in RadGrid

I have Radgrid with all rows always in edit mode. I want following functionality in one of the columns: after item is edited, all rows in this colum take this value. Here is how my column looks like.

How to get value of column in OnItemCreated event in telerik C#

I have telerik grid and I want to get the value of GridBoundColumn in OnItemCreated event here is my code <telerik:RadGrid OnNeedDataSource=RGrid_NeedDataSource AutoGenerateColumns=false OnIte

How to show column Total at footer in radGrid telerik

How to show column Total at radGrid footer in Telerik.

How To Get Name of Column For Cell Selected In Telerik RadGrid?

How To Get Name of Column For Cell Selected In Telerik RadGrid ? Id Name LastName Telephone 1 jo jol 098 2 mo mol 987 3 fo fol 394 4 do doo 234 5 me mee 245 //Example Here i want to retrieve Name of

Accessing a value in a radGrid column

I want to access a value in a radGrid control. Given the image below, I want to access the value of Status. But I can’t seem to get it. I get an error message Unable to cast object of type ‘Trip

Get RadGrid row value through a button column in the grid

I have a column with a button in my radgrid, I want to be able to click the button and get the values of the row in which the button is located on. This must be done without selecting the row, I remem

Set value column value of the selected row in RadGrid

I need to set the value of a particular column of the selected row in my telerik RadGrid. I have tried the following, but it didn’t work. foreach (GridDataItem row in RadGrid1.Items) { if (row.Selecte

Answers

First get the id and then from that id u will get name with:

int id = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"];

You can use UniqueName to get the value of the column:

da.item[“UniqueName”].Text