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

How set text, header-text, ... of an RadGrid in code behind ?

5 Answers 1584 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jérémy
Top achievements
Rank 1
Jérémy asked on 27 Mar 2015, 09:53 AM
Hi,

I want initilize text of my Rad Grid on the OnInit(EventArgs e) method. How set, for example, the text and HeaderText of this GridButtonColumn ?

<telerik:RadGrid runat="server" ID="grid1"  ....>
                <MasterTableView DataKeyNames="Id1" ....>
                    <Columns>
                        <telerik:GridButtonColumn CommandName="Edit" ButtonType="ImageButton" Text="Modifier" HeaderText="Edit" UniqueName="EditColumn"></telerik:GridButtonColumn>
...
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

Thanks

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 01 Apr 2015, 06:38 AM
Hi Vallin,

You can use the GetColumn method to access the GridButtonColumn and apply any required settings:
http://www.telerik.com/help/aspnet-ajax/grid-using-getitems-getcolumn-methods.html

However, please note that the Init event is raised too early in the page life cycle and you will need to use the grid Load or PreRender event handlers to achieve this functionality.

Hope this helps.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jérémy
Top achievements
Rank 1
answered on 01 Apr 2015, 07:58 AM
Hi,

Thanks for your answer, it works for set the HeaderText !

I have last questions, how :
- set the TextConfirm of an GridButtonColumn  (headertext tooltip.png)
- set the ToolTip of an button (button tooltip.png)

Thanks !
0
Eyup
Telerik team
answered on 06 Apr 2015, 08:48 AM
Hi Vallin,

Can you please elaborate on your specific scenario? If you instruct us the exact steps and functionality you need to implement, we can prepare a sample RadGrid web site and send it to you.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jérémy
Top achievements
Rank 1
answered on 07 Apr 2015, 09:33 AM
Hi,

 I have already a RadGrid (as you can see in the first post).

I simply want know if it's possible to change the tooltip of an button in the RadGrid (button tooltip.png), change the tooltip of an HeaderText (headertext tooltip.png) and change the textConfirm on an GridButtonColumn.

 

It's take the default value and I want force to different value.

 

Thankx

0
Eyup
Telerik team
answered on 10 Apr 2015, 08:56 AM
Hello Vallin,

You can make avail of the following properties to achieve that:
<telerik:GridButtonColumn CommandName="Edit" HeaderTooltip="Custom Header ToolTip"
    ConfirmText="Are you sure?" Text="Button ToolTip" UniqueName="ButtonColumnName"
    HeaderText="Buttons" ButtonType="ImageButton">
</telerik:GridButtonColumn>

Alternatively, you can use the following approach:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        ImageButton button = item["ButtonColumnName"].Controls[0] as ImageButton;
 
        string value = DataBinder.Eval(item.DataItem, "ShipName").ToString();
        button.ToolTip = "ToolTip for " + value;
    }
}

That should do the trick.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Jérémy
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Jérémy
Top achievements
Rank 1
Share this question
or