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

Accessing label object inside NoRecordsTemplate

5 Answers 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dexter
Top achievements
Rank 1
dexter asked on 09 Feb 2012, 09:59 AM
Hi,

I'm trying to get the reference of the label object inside NoRecordsTemplate using client side.
Is it possible? How?


Thanks.
Dexter

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 09 Feb 2012, 12:37 PM
Hi dexter,
$telerik.$("tr.rgNoRecords >td>div")[0].innerHTML

Hope it helps.

Greetings, Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
dexter
Top achievements
Rank 1
answered on 10 Feb 2012, 02:30 AM
Hi,

Thank you very much for your reply. Unfortunately, it didn't work. It returns undefined.
The label i'm trying to access is as below:
<NoRecordsTemplate
  <table>
    <tr>
      <td align="center" valign="middle">
        <asp:Label runat="server" ID="lblNoRecords" CssClass="label"></asp:Label>
      </td>
    </tr>
  </table>
</NoRecordsTemplate>

On another matter, the code you sent me :

$telerik.$(

 

"tr.rgNoRecords >td>div")[0];
What kind of accessing method is this? Is this somewhat like XSLT?
Where is the documentation for this access method?

Regards,
Dexter

 

0
Tsvetoslav
Telerik team
answered on 10 Feb 2012, 08:48 AM
Hello Dexter,

I was not aware that you are using a custom template. Here is a possible solution:
$telerik.$("tr.rgNoRecords >td").find(".label")[0].innerHTML

Do note that ".label" refers to the css class and not to the type of the server control which besides that is rendered on the client as a <span> element in your case.

And this jQuery - the $telerik.$ exposes its API. More information you can find below:
http://docs.jQuery.com

Hope it helps.
 
Regards,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
dexter
Top achievements
Rank 1
answered on 14 Feb 2012, 02:27 AM
Hi Tsvetoslav,

Thanks for your help. Its working now. However, the jquery link you sent me doesn't
seem to explain how to use the symbols like '>'.  Do you mind giving me another link?

Thanks again.
Dexter
0
Tsvetoslav
Telerik team
answered on 14 Feb 2012, 10:23 AM
Hello Dexter,

Certainly I don't: http://api.jquery.com/category/selectors/ 

In particular, do take a look at the parent-child selector.

 

Greetings,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
dexter
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
dexter
Top achievements
Rank 1
Share this question
or