Hi,
I have written code on ItemDataBound event of grid to check certain condition. If that condition is met then I would like to make 'Delete' button in GridButtonColumn and 'Edit' button in GridEditCommandColumn invisible for that row. For other rows these buttons should be visible.
I have managed to make these button invisible but for those rows and for these two columns only it is not showing gridlines and it looks weird. How to make it show gridlines but make image buttons invisible?
Thanks.
I have written code on ItemDataBound event of grid to check certain condition. If that condition is met then I would like to make 'Delete' button in GridButtonColumn and 'Edit' button in GridEditCommandColumn invisible for that row. For other rows these buttons should be visible.
I have managed to make these button invisible but for those rows and for these two columns only it is not showing gridlines and it looks weird. How to make it show gridlines but make image buttons invisible?
Thanks.
5 Answers, 1 is accepted
0

Jayesh Goyani
Top achievements
Rank 2
answered on 29 Jul 2011, 09:48 PM
HI,
let me know if any concern
Thanks,
Jayesh Goyani
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"true"
PageSize
=
"15"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
AutoGenerateColumns
=
"false"
>
<
MasterTableView
DataKeyNames
=
"Name"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Name"
HeaderText
=
"Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditColumn"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
asp:Button
ID
=
"btnDelete"
runat
=
"server"
CommandName
=
"Delete"
Text
=
"Delete"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
string
strName = item.GetDataKeyValue(
"Name"
).ToString();
if
(strName ==
"1"
)
{
Button btnDelete = (Button)item.FindControl(
"btnDelete"
);
btnDelete.Visible =
false
;
LinkButton lnkEdit = (LinkButton)item[
"EditColumn"
].Controls[0];
lnkEdit.Visible =
false
;
// if your Edit button type is ButtonType="ImageButton" then u can get here imagebutton in place of linkbutton
}
}
}
}
let me know if any concern
Thanks,
Jayesh Goyani
0

Archana
Top achievements
Rank 1
answered on 30 Jul 2011, 12:16 AM
Its not working.
Attaching is the screenshot of what my gris looks like.
Attaching is the screenshot of what my gris looks like.
0

Jayesh Goyani
Top achievements
Rank 2
answered on 30 Jul 2011, 07:42 AM
hi,
please send your code so we can identify the actual problem.
thanks,
Jayesh Goyani
please send your code so we can identify the actual problem.
thanks,
Jayesh Goyani
0

Jayesh Goyani
Top achievements
Rank 2
answered on 30 Jul 2011, 07:55 AM
Hi,
Now, i am able to generate the issue.
The issue is related to browser compatibility.
i will try to solve this issue and update you shortly.
Thanks,
Jayesh Goyani
Now, i am able to generate the issue.
The issue is related to browser compatibility.
i will try to solve this issue and update you shortly.
Thanks,
Jayesh Goyani
0
Accepted
Hi guys,
See this forum post which elaborates on the same subject:
http://www.telerik.com/community/forums/aspnet-ajax/grid/border-not-displayed-if-cell-is-empty-in-internet-explorer.aspx
Best regards,
Sebastian
the Telerik team
See this forum post which elaborates on the same subject:
http://www.telerik.com/community/forums/aspnet-ajax/grid/border-not-displayed-if-cell-is-empty-in-internet-explorer.aspx
Best regards,
Sebastian
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.