Rad Grid

1 posts, 0 answers
  1. Rey
    Rey avatar
    2 posts
    Member since:
    Jul 2015

    Posted 09 Oct 2015 Link to this post

    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" 
                                OnDeleteCommand="grdSavedSourceDirectories_DeleteCommand" DataSourceID="UploadDirectorys" CellSpacing="-1" GridLines="Both" >
                                <mastertableview pagesize="7">
                                    <CommandItemSettings ShowAddNewRecordButton="False" />
                                        <telerik:GridBoundColumn FilterControlAltText="Filter Description column" HeaderText="Description" UniqueName="Description" DataField="Description" SortExpression="Description">
                                        <telerik:GridBoundColumn DataField="Path" FilterControlAltText="Filter Path column" HeaderText="Location" SortExpression="Path" UniqueName="Path">
                                        <telerik:GridBoundColumn DataField="DirectoryId" UniqueName="DirectoryId" Visible="false">



    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


Back to Top