This is a migrated thread and some comments may be shown as answers.

RadGrid Delete ImageButton not working...

2 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chet Watkins
Top achievements
Rank 1
Chet Watkins asked on 19 Jan 2009, 04:44 PM
I have a radGrid that is not kicking off the delete method when using an ImageButton, the LinkButton and PushButton work fine..

I have tried creating the column manually and also auto generating with code on columncreate that changes it to an imagebutton and neither work. Please help.

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"   
    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"   
    GridLines="None" ShowGroupPanel="True" Skin="WebBlue"   
        ondeletecommand="RadGrid1_DeleteCommand" AutoGenerateDeleteColumn="True"   
        oncolumncreated="RadGrid1_ColumnCreated1" > 
<HeaderContextMenu> 
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</HeaderContextMenu> 
 
<MasterTableView> 
    <Columns> 
        <telerik:GridHyperLinkColumn DataNavigateUrlFields="FilePath"   
            DataTextField="FileName" HeaderText="Attachments" UniqueName="column2">  
        </telerik:GridHyperLinkColumn> 
        <telerik:GridBoundColumn DataField="AttachType" HeaderText="Attachment Type"   
            UniqueName="column1">  
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
 
    <ClientSettings AllowDragToGroup="True">  
    </ClientSettings> 
 
<FilterMenu> 
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
<PagerStyle NextPageText="Next" PrevPageText="Prev" Mode="NextPrevAndNumeric">  
                </PagerStyle> 


        protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)  
        {  
            blSharePoint spFiles = new blSharePoint(spPath);  
 
            GridDataItem filePath = (GridDataItem)e.Item;  
            HyperLink test = (HyperLink)filePath["column2"].Controls[0];  
 
            spFiles.DeleteDocFromProposalFolder(test.NavigateUrl.ToString());  
 
            RadGrid1.DataSource = spFiles.ListFileCollectionFromProposalFolder(CurrentLocation, "Proposal Documents", CurrentProposalNumber, "Attachment Type");  
            RadGrid1.DataBind();  
        }  
 
 
        protected void RadGrid1_ColumnCreated1(object sender, GridColumnCreatedEventArgs e)  
        {  
            if (e.Column.UniqueName == "AutoGeneratedDeleteColumn")  
            {  
                GridButtonColumn btncol = (GridButtonColumn)e.Column;  
                btncol.ButtonType = GridButtonColumnType.ImageButton;  
            }  
        } 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2009, 09:28 AM
Hi Chet,

Are you by any chance calling a DataBind() method inside the PageLoad event? If so try removing that and see whether the DeleteCommand is getting fired.  You can also refer the following forum link which discusses a similar issue.
GridButtonColumn and OnDeleteCommand

Regards
Shinu

0
Chet Watkins
Top achievements
Rank 1
answered on 20 Jan 2009, 07:34 PM
Yup that fixed the problem. I did a search and did not see that post. That you for pointing it out.
Tags
Grid
Asked by
Chet Watkins
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Chet Watkins
Top achievements
Rank 1
Share this question
or