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

Assign text to <telerik:GridButtonColumn> using javascript OnRowDataBound Event

5 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sandeep
Top achievements
Rank 1
Sandeep asked on 23 Apr 2012, 01:26 PM
I have a RadGrid. In this RadGrid I ahve below code

<MasterTableView ClientDataKeyNames="ID,Name,Path" runat="server" >
     <Columns>
            <telerik:GridButtonColumn UniqueName="headerDelete" CommandName="Delete"
runat="server" ButtonType="ImageButton" ImageUrl="~/CommonUI/Images/delete.png"
HeaderTooltip ="hhhh" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-Width="40px" HeaderStyle-HorizontalAlign="Center" Text="Delete"/>
       </Columns>
 </MasterTableView>

I want to Add Text to telerik:GridButtonColumn using OnRowDataBound event in javascript because i am filling this grid from another
grid using WebService and javascript function. Like

var tableView = $find("<%= gridSelected.ClientID %>").get_masterTableView();
                tableView.set_dataSource(result);
                tableView.dataBind();

Please suggest How can add text for <telerik:GridButtonColumn> using javascript for it ?

Thanks

 

 

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 25 Apr 2012, 06:13 AM
Hello Sandeep,

Please check below code snippet.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" >
                <MasterTableView >
                    <Columns>
........
.............
                          <telerik:GridButtonColumn  HeaderText="Test" UniqueName="Test" Text="123">
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnRowDataBound="RowDataBound" />
                </ClientSettings>
            </telerik:RadGrid>

function RowDataBound(sender, args) {
                
               args.get_item().get_cell("Test").getElementsByTagName('a')[0].innerHTML = "jayesh";
           }



Thanks,
Jayesh Goyani
0
Sandeep
Top achievements
Rank 1
answered on 26 Apr 2012, 11:27 AM
Jayesh,

It is not working. I am using image as button so innerHTML is undefined for image.

Thanks.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Apr 2012, 07:45 PM
Hello sandeep,

If you used image button as button type then how can you set text in button.

you must have to set imageurl/tooltip/alternatetext.

Thanks,
Jayesh Goyani
0
Sandeep
Top achievements
Rank 1
answered on 27 Apr 2012, 07:59 AM
Correct Jayesh,

I want same thing. I want to set tooltip/alternatetext. But Here we set as a Text property of Button in .aspx page means <telerik:GridButtonColumn> Text property it behaves like tooltip/alternate text. So My question is How can set   tooltip/alternatetext for <telerik:GridButtonColumn> using javascript OnRowDataBoundEvent Where <telerik:GridButtonColumn> 
is a Image type button ?

Thanks. 

0
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Apr 2012, 10:16 AM
Hello sandeep,

function RowDataBound(sender, args) {
               args.get_item().get_cell("Test").getElementsByTagName('input')[0].title = "jayesh";
               args.get_item().get_cell("Test").getElementsByTagName('input')[0].alt = "alter text";
               
           }


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Sandeep
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Sandeep
Top achievements
Rank 1
Share this question
or