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

Displaying message within RadGrid

2 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Jakech
Top achievements
Rank 1
Robert Jakech asked on 29 Mar 2010, 08:31 AM
Hi,
I want to display a message when i click a button.
So, from server side in my button_click i have below code:
grid.Controls.Add(new LiteralControl(string.Format("<span style='color:red;font-size:Large;'>{0}</span>", text)));

The message displays fine. but it is displaying my grid's footer.

Can someone help me with a code to align the message on top (header?).
I really need this badly.
I understand we can use,
grid.Controls.AddAt('position',new LiteralControl(string.Format("<span style='color:red;font-size:Large;'>{0}</span>", text)));

How can i set the position to grid's header?

thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 29 Mar 2010, 11:16 AM
Hi,

For displaying a message on top of your grid, you can add your literal control to the GridCommandItem rather than adding it to header. Here is the code that I tried:

C#:
protected void Button1_Click(object sender, EventArgs e) 
    GridCommandItem gridCommandItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
    LiteralControl lt = new LiteralControl(string.Format("<span style='color:red;font-size:Large;'>{0}</span>""frtesrter")); 
    gridCommandItem.Cells[0].Controls.Add(lt); 

Regards
Princy.
0
Robert Jakech
Top achievements
Rank 1
answered on 29 Mar 2010, 12:03 PM
You have just reduced my sleepless night by 7 days.

Thank yoo very much.
Tags
Grid
Asked by
Robert Jakech
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Robert Jakech
Top achievements
Rank 1
Share this question
or