I have a WebGrid Which is having an UltraGridColumn of type "Button".
My question is How can I set the button text. I checked it has ButtonTextStyle but I couldn't find any property with which I can set button Text.
Thanks.
Set the Text (or Value) of the cell that represents the button in question. That text will be displayed on the button for that individual cell.
If you're databinding your grid, the InitializeRow event is a good place to do this. Otherwise, you would set the cells' Text/Value as you're dynamically creating the rows.
I tried doing both here is my code.
and in code behind on InitializeRow I am did this thing.
e.Row.Cells.FromKey(CellButton).Text =
but none of these seems to be working.
If the Key property of your column is "Button", try the following in InitializeRow instead:
e.Row.Cells.FromKey("Button").Value = "...";
If this doesn't work, try setting a breakpoint on this line of code, to make sure that your InitialzeRow event is being called. The event might not be hooked up right, or there may be some other reason why it's not being called.
If this doesn't help, then we may need to look into this in more depth than I can do over the forums. In this case, please submit a support request and attach a concise sample project that we can run and debug that shows setting of a cell's Value not showing that text on a Button style column. Providing a sample will help ensure that we're running the same code as you are.
I have this on my page.
private
so that is right key.
and this event handler is being called. because I am also doing some other things on Init row handler and I checked also as you have said but still it is not being set with setting value or text as you have said.
I am sorry my bad.
it is being set but its too small that I coudn't see it without zooming it in.
thanks.