Hello:
When the user click "Add new row", I need to disable it,
for example,
if the user click on "Add New Row" the program execute a routine that return a boolean,
if the routine return true then "Add new row" must to display a message "You can't add more rows".
And the inputs for insert don't must appear.
Can you help me?
Thanks.
When the user click "Add new row", I need to disable it,
for example,
if the user click on "Add New Row" the program execute a routine that return a boolean,
if the routine return true then "Add new row" must to display a message "You can't add more rows".
And the inputs for insert don't must appear.
Can you help me?
Thanks.
4 Answers, 1 is accepted
0
Schlurk
Top achievements
Rank 2
answered on 20 Oct 2009, 09:39 PM
You could try the following piece of code after the boolean is returned:
To disable that particular button. You could then perhaps take use of a RadAlert or another RadWindow to display your error message.
GridCommandItem myItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; |
((LinkButton)myItem.FindControl("InitInsertButton")).Visible = false; |
To disable that particular button. You could then perhaps take use of a RadAlert or another RadWindow to display your error message.
0
rema43001
Top achievements
Rank 1
answered on 21 Oct 2009, 09:50 PM
Thanks Schlurk
It's possible to acces the EditButton?
GridCommandItem myItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
((LinkButton)myItem.FindControl("EditButton")).Visible = false;
this return the error {"Object reference not set to an instance of an object."}
Can you help me?
Thanks
It's possible to acces the EditButton?
GridCommandItem myItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
((LinkButton)myItem.FindControl("EditButton")).Visible = false;
this return the error {"Object reference not set to an instance of an object."}
Can you help me?
Thanks
0
Shinu
Top achievements
Rank 2
answered on 22 Oct 2009, 05:38 AM
Hello,
I hope you want to hide the autogenerated EditButton in the grid from code behind. If so you can try following code in ItemDataBound event.
CS:
-Shinu.
I hope you want to hide the autogenerated EditButton in the grid from code behind. If so you can try following code in ItemDataBound event.
CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem myItem = (GridDataItem)e.Item; |
((LinkButton)myItem.FindControl("AutoGeneratedEditButton")).Visible = false; |
} |
} |
-Shinu.
0
rema43001
Top achievements
Rank 1
answered on 11 Nov 2009, 06:01 PM
Thanks Schlurk, for the code hide the InitInsertButton
GridCommandItem myItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
((LinkButton)myItem.FindControl("InitInsertButton")).Visible = false;
But is necessary to hide the Image next to "Add new row" that have the same function.
Anyone know how to hide this?
Thanks.