Hi,
MasterPage>Default.aspx>MainUserControl.ascx
MainUserControl.ascx has a tabstrip and multipage which in turns holds 5 other user controls each having a RadGrid.
On each grid I need to open a window from one of the grid columns and pass through the row a data item.
I have tried from your examples both using the javascript function called from the ItemCreated event and also direct from code behind.
In some cases this works but not always and not on every grid.
I've tried changing viewstate, adding and taking away window managers and everything else I can think of.
Is there a prescribed method or sample that will show this functionality please?
Thanks,
Jon
MasterPage>Default.aspx>MainUserControl.ascx
MainUserControl.ascx has a tabstrip and multipage which in turns holds 5 other user controls each having a RadGrid.
On each grid I need to open a window from one of the grid columns and pass through the row a data item.
I have tried from your examples both using the javascript function called from the ItemCreated event and also direct from code behind.
In some cases this works but not always and not on every grid.
I've tried changing viewstate, adding and taking away window managers and everything else I can think of.
Is there a prescribed method or sample that will show this functionality please?
Thanks,
Jon
5 Answers, 1 is accepted
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 23 Sep 2011, 03:05 AM
Does the window open in IFrame mode (ContentURL), or is it a ContentTemplate implementation?
0
Jon
Top achievements
Rank 1
answered on 23 Sep 2011, 05:02 AM
Hi Steve - Thanks for the reply.
I use the iFrame mode, NavigateURL - not a content template in the page.
Cheers,
Jon
I use the iFrame mode, NavigateURL - not a content template in the page.
Cheers,
Jon
0
Accepted
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 23 Sep 2011, 06:25 PM
What I would do is have every grid have a button column, and on click of that button call a single function in the (master) ascx control, passing in the data you need.
So then inside that click event you set the window content url and pass the data along the querystring
Or perhaps you just handle a clientside grid row selected event
...and get access to the rows dataitem that way?
If you do choose to use a button to pass args might I suggest the RadButton as you can assign CommandArgs to it which you have easy access to on the clientside. So in the clicking event of the radbutton you just need to do: var data = args.get_commandArgument(); which would contain the dataitems you need to pass.
So then inside that click event you set the window content url and pass the data along the querystring
<
script
type
=
"text/javascript"
>
function openWindow(data){
//get the window
var window = $find('<%= RadWindow1.ClientID %>');
window.setUrl("http://www.site.com/detailspage.aspx?id=" + data);
window.show();
}
</
script
>
Or perhaps you just handle a clientside grid row selected event
function ActiveRowChanged(sender, eventArgs) {
}
...and get access to the rows dataitem that way?
There's lots of ways to do it, but I prefer the clientside, just way more slick for the users instead of postbacks. The only complex part I see is getting the data you need to pass down to the function somehow.//or perhaps pass the dataItem to the windowOpen function above...?var
dataItem = eventArgs.get_gridDataItem());
If you do choose to use a button to pass args might I suggest the RadButton as you can assign CommandArgs to it which you have easy access to on the clientside. So in the clicking event of the radbutton you just need to do: var data = args.get_commandArgument(); which would contain the dataitems you need to pass.
0
Jon
Top achievements
Rank 1
answered on 26 Sep 2011, 09:52 AM
Fantastic Steve,
I tried with the RadButton but couldn't pass the data item - I'll keep at looking at that, but I did it this way in the end.
In the holding ascx page...
Then in any Grid Template used this..
Great stuff, all working nicely on the client.
Thanks ever so much for your help!
Cheers,
Jon
I tried with the RadButton but couldn't pass the data item - I'll keep at looking at that, but I did it this way in the end.
In the holding ascx page...
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function openWindow(data){
//get the window
var window = $find('<%= RadWindow1.ClientID %>');
window.setUrl("modals/Details.aspx?jID=" + data);
window.show();
}
</
script
>
</
telerik:RadCodeBlock
>
Then in any Grid Template used this..
<
a
href
=
"#"
onclick
=
"openWindow('<%# DataBinder.Eval(Container.DataItem, "
ID") %>'); return false;">
<
asp:ImageButton
ID
=
"btntest"
runat
=
"server"
ImageUrl
=
"~/images/icons/messages.png"
/>
</
a
>
Great stuff, all working nicely on the client.
Thanks ever so much for your help!
Cheers,
Jon
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 26 Sep 2011, 02:36 PM
Glad I could help :)
If it's not too much trouble, do you mind marking the post as answered for me? :)
If it's not too much trouble, do you mind marking the post as answered for me? :)