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

Find Value In Java Script

5 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 05 Sep 2012, 07:24 AM
I want to find radgrid inside CommandItemTemplate in java script
<telerik:radgrid>
<MasterTableView  AllowFilteringByColumn="true" IsFilterItemExpanded="false" HeaderStyle-Width="200px" ItemStyle-Width="200px" CommandItemDisplay="Top" DataKeyNames="lid"  ClientDataKeyNames="lid" Width="100%">
            <CommandItemTemplate>          
 <td>  <telerik:RadButton EnableSplitButton="true" ID="SplitButton" AutoPostBack="false"
                runat="server" Text="Transfer Item" OnClientClicked="OnClientClicked">
            </telerik:RadButton>
            <telerik:RadContextMenu ID="RadContextMenu1" runat="server" >
                <Items>
                    <telerik:RadMenuItem Text="Transfer Right">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Transfer Left">
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadContextMenu>



Thanks Advance,
Mohamed.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Sep 2012, 07:40 AM
Hi Mohammed,

I suppose you want to access the RadGrid inside the OnClientClicked event in the javascript. Please add an ID for the RadGrid.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server">
    <MasterTableView  AllowFilteringByColumn="true" IsFilterItemExpanded="false" HeaderStyle-Width="200px" ItemStyle-Width="200px" CommandItemDisplay="Top" DataKeyNames="lid"  ClientDataKeyNames="lid" Width="100%">
           . . .

Javascript:
<script type="text/javascript">
    function OnClientClicked()
    {
        var grid = $find("<%=RadGrid1.ClientID %>"); //access the radgrid
    }
</script>

Thanks,
Shinu.
0
mohamed
Top achievements
Rank 1
answered on 05 Sep 2012, 07:46 AM
This Is the Way I find ,
Now it works fine

                    var radGrid = $find("<%= PeopleRadGrid.ClientID %>");
                    var radToolBar = $telerik.findControl(radGrid.get_element(), "RadContextMenu1");



Thanks Advance,
Mohamed.
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Sep 2012, 09:15 AM
Hello,

function OnClientClicked(sender,args) {
              var SenderId = sender.get_element().id;
              var RadContextMenu1 = $find(SenderId.replace("SplitButton", "RadContextMenu1"));
          }


Thanks,
Jayesh Goyani
0
mohamed
Top achievements
Rank 1
answered on 05 Sep 2012, 12:31 PM
Thanks For you reply

How i Find asp control value in that place
<asp:label runat="server" id="moh"></asp:label>
                <telerik:radbutton enablesplitbutton="true" id="SplitButton" autopostback="false"
                    runat="server" onclientclicked="OnClientClicked">
            </telerik:radbutton>
                <telerik:radcontextmenu id="RadContextMenu1" runat="server" onclientitemclicked="OnClientItemClicked">              
            </telerik:radcontextmenu>


Thanks Advance,
Mohamed.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Sep 2012, 03:23 AM
Hi Mohammed,

I guess you want to access the Label.Please take a look into the following code snippet.

Javascript:
<script type="text/javascript">
    function OnClientClicked()
    {
        var grid = $find("<%=RadGrid1.ClientID %>");
        var label = $telerik.findElement(grid.get_element(), "moh");
    }
</script>

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