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

NodeValue with GridViewPostBack

7 Answers 98 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Thiago
Top achievements
Rank 1
Thiago asked on 20 Jun 2008, 07:11 PM
Hi everyone!

I made an treeview that's receive many datas, and i made that when the user clicks in the node thats haves the certain atribute category, they put in variable the value of the node. Like this:

function

onNodeClicking(sender, args)

{

// Verifica se a categoria do n¢ ‚ igual a '3'. Se for Pega o Valor dele

if(args.get_node().get_category() == "Categoria 3")

{

var valor = args.get_node().get_value();

}

}

this in the jscript, but i need when the user clicks in this and get this value, an gridview that is inside "radTabStrip" and only this gridview, get the services that has that value. The treeview can not do an postback, only the gridview can do this.But i try and try to do this and nothing :(.Have any way to do this, get the value of a node and async triggers an gridview whitout the postback, or without an treeview postback?

Thanks,

7 Answers, 1 is accepted

Sort by
0
Thiago
Top achievements
Rank 1
answered on 22 Jun 2008, 02:51 PM
need help please, someone!!
:P

0
Atanas Korchev
Telerik team
answered on 23 Jun 2008, 02:23 PM
Hello Thiago,

The treeview should somehow trigger postback or ajax in order to update the grid. Maybe you can use RadAjaxManager and add a setting with initiator the manager and updated control - the grid. Then use the ajaxRequest client-side method from the nodeClicking event to initiate the ajax request. On the server side use the AjaxRequest event of the AjaxManager to update the grid. Here is a short example:

ASPX:
<telerik:RadAjaxManager
   ID="RadAjaxManager1"
   runat="server"
   OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="GridView1"></telerik:AjaxUpdatedControl>
        </UpdatedControls>
     </telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>

<script type="text/javascript">
function onNodeClicking(sender, args)
{
    // Verifica se a categoria do n¢ ‚ igual a '3'. Se for Pega o Valor dele
    if(args.get_node().get_category() == "Categoria 3")
    {
        var valor = args.get_node().get_value();
        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
        ajaxManager.ajaxRequest(valor);
    }
}
</script>

Codebehid:

protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
   string nodeValue = e.Argument; //The node value passed from the client-side when calling the ajaxRequest method
  
   //Data bind the grid here
  
}

I hope this helps,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Thiago
Top achievements
Rank 1
answered on 23 Jun 2008, 10:57 PM
Hi, thanks its helps alot! but still need a little help...

In this function:

function

onNodeClicking(sender, args)

{

// Verifica se a categoria do n½ ‚ igual a '3'. Se for Pega o Valor dele

if(args.get_node().get_category() == "Categoria 3")

{

var valor = args.get_node().get_value();

var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");

ajaxManager.AjaxRequest(valor);

}

}

I get an error script in this line-

ajaxManager.AjaxRequest(valor);

so i make an text bot thats prints the ajaxManager and i the text box prints "null", so i think what happens?maybe he dont found de ajaxManager, What can be this?
The radAjaxManager is in my master page,  its fine?

tks,

0
Atanas Korchev
Telerik team
answered on 24 Jun 2008, 06:17 AM
Hi Thiago,

Could you please check if your RadAjaxManager is properly rendered in your page? Look for something like this:
$create(Telerik.Web.UI.RadAjaxManager

The last parameters of the $create routine should look like this:

$get("SomeValue")

where "SomeValue" is the correct ID of your RadAjaxManager which you can later use in $find().


Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Thiago
Top achievements
Rank 1
answered on 24 Jun 2008, 01:34 PM
Ohh my god, its works!Thanks!!!! many thanks!u are the best :P!i verify what u say and:

var

ajaxManager = $find("ctl00_RadAjaxManager1");

why the control have this name "ctl00_RadAjaxManager1" and why i cant get whith "$find("<%= RadAjaxManager1.ClientID %>");"?

0
Atanas Korchev
Telerik team
answered on 24 Jun 2008, 01:59 PM
Hello Thiago,

Controls from master pages receive a default prefix "ctl00". You can find more info in this blog post.

Are you using the <%= RadAjaxManager1.ClientID %> in your content page? If yes - it is likely it won't work. You can try this as a workaround:

<%= Maser.FindControl("RadAjaxManager1").ClientID %>

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Thiago
Top achievements
Rank 1
answered on 24 Jun 2008, 04:13 PM
Thanks! Now its finally works :P

And many thanks for the link!

Tags
TreeView
Asked by
Thiago
Top achievements
Rank 1
Answers by
Thiago
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or