Although it may seem simple enough I am having a tough time figuring this out. I have a RadGrid
<telerik:RadGrid ID="grdSavedSourceDirectories"
Visible="False" runat="server"
AutoGenerateColumns="False"
GroupPanelPosition="Top"
AllowAutomaticDeletes="True"
AutoGenerateDeleteColumn="True"
OnDeleteCommand="grdSavedSourceDirectories_DeleteCommand" DataSourceID="UploadDirectorys" CellSpacing="-1" GridLines="Both" >
<mastertableview pagesize="7">
<CommandItemSettings ShowAddNewRecordButton="False" />
<Columns>
<telerik:GridBoundColumn FilterControlAltText="Filter Description column" HeaderText="Description" UniqueName="Description" DataField="Description" SortExpression="Description">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Path" FilterControlAltText="Filter Path column" HeaderText="Location" SortExpression="Path" UniqueName="Path">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DirectoryId" UniqueName="DirectoryId" Visible="false">
</telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
What I want to do is get the value of the "DirectoryId". What I did is add a delete link. When it is clicked it fires of the code behind. What I need to do is grab the Directory ID and run a stored procedure to delete the row. I can seem to access the ID by doing the below code however since it is in a for loop I only get the last one. Any ideas?
string DirectoryId = "";
foreach (GridDataItem dataItem in grdSavedSourceDirectories.Items)
{
DirectoryId = dataItem["DirectoryId"].Text.ToString();
}
Thanks in advance