Dear Telerik Team,
I am using a RadGrid and loading Item values on page load. When i click on Row I need to fire OnClientRowSelected event which is working well in IE but causing problem in MozillaFirefox by showing undefined. Where i need to load RadEditor with some values.
Thanks Inadvance
Regards
----------
Pandu
14 Answers, 1 is accepted
0
Hello Pandu,
We need some more details to be able to better understand your scenario. Are you using client-side binding? What is the message of the javascript error you are getting? If you can provide us some sample code we can examine, we will be able to identify the cause for the exception.
Kind regards,
Veli
the Telerik team
We need some more details to be able to better understand your scenario. Are you using client-side binding? What is the message of the javascript error you are getting? If you can provide us some sample code we can examine, we will be able to identify the cause for the exception.
Kind regards,
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Charlie
Top achievements
Rank 1
answered on 13 Jul 2010, 10:00 PM
I'm having a similar problem. My process flows like this:
Note: I am using the 2009.3.1314.35 Telerik controls (which if I'm correct, are the Q3 2009 controls)
I have a RadGrid with an OnRowClick="RowSelected" ClientEvent.
My RowSelected javascript function:
function RowSelected(sender, eventArgs) {
var ajaxManager = $find('PageAjaxManager');
ajaxManager.ajaxRequestWithTarget('lnkPopulate', '');
}
That then hits the PageAjaxManager to update the lnkPopulate control, which has an OnClick value of lnkPopulate_Click.
The first thing to happen in my lnkPopulate_Click function in my C# code is:
foreach (GridDataItem gdi in grid.SelectedItems)
In Firefox 3.6 and Chrome 5.0 (and quite possibly Safari, though I have not tested this), grid.SelectedItems is 0. In Internet Explorer 8 (running in IE7 Compatibility mode), grid.SelectedItems is 1. Is there something special I need to do to make this functionality work cross-browser?
(Sorry in advance for not having code blocks for the code...I can't figure out how to do them)
Note: I am using the 2009.3.1314.35 Telerik controls (which if I'm correct, are the Q3 2009 controls)
I have a RadGrid with an OnRowClick="RowSelected" ClientEvent.
My RowSelected javascript function:
function RowSelected(sender, eventArgs) {
var ajaxManager = $find('PageAjaxManager');
ajaxManager.ajaxRequestWithTarget('lnkPopulate', '');
}
That then hits the PageAjaxManager to update the lnkPopulate control, which has an OnClick value of lnkPopulate_Click.
The first thing to happen in my lnkPopulate_Click function in my C# code is:
foreach (GridDataItem gdi in grid.SelectedItems)
In Firefox 3.6 and Chrome 5.0 (and quite possibly Safari, though I have not tested this), grid.SelectedItems is 0. In Internet Explorer 8 (running in IE7 Compatibility mode), grid.SelectedItems is 1. Is there something special I need to do to make this functionality work cross-browser?
(Sorry in advance for not having code blocks for the code...I can't figure out how to do them)
0
Hi Charlie,
You need to make sure the AJAX manager updates both RadGrid and the LinkButton in this case:
You can also use an alternative approach to implement this scenario. RadGrid can postback when a row is selected automatically. You need set:
You can then subscribe to RadGrid's ItemCommand event and handle your logic there:
Any of these two approaches should work for you. If they don't, we are going to have to look at some code to further advise you.
All the best,
Veli
the Telerik team
You need to make sure the AJAX manager updates both RadGrid and the LinkButton in this case:
<
telerik:RadAjaxManager
ID
=
"PageAjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"PageAjaxManager"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"lnkPopulate"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
You can also use an alternative approach to implement this scenario. RadGrid can postback when a row is selected automatically. You need set:
<
ClientSettings
EnablePostBackOnRowClick
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
You can then subscribe to RadGrid's ItemCommand event and handle your logic there:
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"RowClick"
)
{
//either invoke the CLick event handler of the link button
//or iterate through the selected grid items right here
}
}
Any of these two approaches should work for you. If they don't, we are going to have to look at some code to further advise you.
All the best,
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Charlie
Top achievements
Rank 1
answered on 14 Jul 2010, 02:52 PM
Thanks Veli! That second solution worked out great for me!
0
Shawn Krivjansky
Top achievements
Rank 1
answered on 03 Aug 2010, 05:18 AM
There is certainly still a problem with this in Firefox.
I'm using the latest 2010 Q2 controls.
Latest IE and Firefox.
My web application project under IE works perfectly with respect to the ClientSettings/ClientEvents "OnRowClick" event processing.
The event DOES fire on firefox, but the problem is that when you handle the event and process the ajax request server-side the RADGRID does NOT have the RADGRID.SelectedValue assigned correctly (per the OnRowClick that just happened). I have debugged it extensively and it seems to be one click behind in firefox. So, the initial "click" on a grid row produces NOTHING for the RADGRID.SelectedValue. Any subsequent clicks of a row will produce a RADGRID.SelectedValue FROM THE PREVIOUS CLICK (not the current clicked row). This happens like clockwork. In IE, the RADGRID.SelectedValue is always for the CURRENT click in this same process.
My ajaxRequest stuff is pretty standard and again....works perfectly under IE:
Can we get a fix for this??
It makes the ClientSettings/ClientEvents OnRowClick pretty unuseable at the moment with this behaviour in Firefox. I mean... there has to be a reason why it works in IE and NOT firefox.
Now, I know there are workarounds... Some that I have played with and implemented have to do with setting the "ClientDataKeyNames" on MasterTableView...retriving that value (key that you clicked on in the grid) in the args of the JS function and passing it along in some way or another. Another way (which is my current method since I hit this road block) is to just set the "EnablePostBackOnRowClick" on the ClientSettings to trigger the RADGRID SelectedIndexChanged event. That seems to work and maybe is easier overall for this case, but it scares me a bit that firefox wouldn't work for the original method.... scares me in the sense that "what else" won't firefox work with that seems pretty simple that IE handles with RADGRID.
Thanks.
I'm using the latest 2010 Q2 controls.
Latest IE and Firefox.
My web application project under IE works perfectly with respect to the ClientSettings/ClientEvents "OnRowClick" event processing.
<ClientSettings>
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowClick="onRadGridPersonVIEW_RowSelected" />
</ClientSettings>
The event DOES fire on firefox, but the problem is that when you handle the event and process the ajax request server-side the RADGRID does NOT have the RADGRID.SelectedValue assigned correctly (per the OnRowClick that just happened). I have debugged it extensively and it seems to be one click behind in firefox. So, the initial "click" on a grid row produces NOTHING for the RADGRID.SelectedValue. Any subsequent clicks of a row will produce a RADGRID.SelectedValue FROM THE PREVIOUS CLICK (not the current clicked row). This happens like clockwork. In IE, the RADGRID.SelectedValue is always for the CURRENT click in this same process.
My ajaxRequest stuff is pretty standard and again....works perfectly under IE:
function onRadGridPersonVIEW_RowSelected(sender, args) {
var ajaxManager = $find("<%= myAjaxManager.ClientID %>");
ajaxManager.ajaxRequest(
"RadGridPersonVIEW_RowSelected");
}
Can we get a fix for this??
It makes the ClientSettings/ClientEvents OnRowClick pretty unuseable at the moment with this behaviour in Firefox. I mean... there has to be a reason why it works in IE and NOT firefox.
Now, I know there are workarounds... Some that I have played with and implemented have to do with setting the "ClientDataKeyNames" on MasterTableView...retriving that value (key that you clicked on in the grid) in the args of the JS function and passing it along in some way or another. Another way (which is my current method since I hit this road block) is to just set the "EnablePostBackOnRowClick" on the ClientSettings to trigger the RADGRID SelectedIndexChanged event. That seems to work and maybe is easier overall for this case, but it scares me a bit that firefox wouldn't work for the original method.... scares me in the sense that "what else" won't firefox work with that seems pretty simple that IE handles with RADGRID.
Thanks.
0
Hello Shawn,
Try the client-side OnRowSelected event instead. This will fire after the row has been selected and the grid updates its state to reflect the selection:
Regards,
Veli
the Telerik team
Try the client-side OnRowSelected event instead. This will fire after the row has been selected and the grid updates its state to reflect the selection:
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
ClientEvents
OnRowSelected
=
"onRadGridPersonVIEW_RowSelected"
/>
</
ClientSettings
>
Regards,
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Mauricio Chotocruz
Top achievements
Rank 2
answered on 09 Aug 2010, 11:04 PM
Hello,
I got the same issue, I try OnRowSelected and OnClick and doesn't work at all, i can't get the SelectedValue. The problem is in firefox, safari, chrome.
Did you find a solution?
I got the same issue, I try OnRowSelected and OnClick and doesn't work at all, i can't get the SelectedValue. The problem is in firefox, safari, chrome.
Did you find a solution?
0
Hi Mauricio,
OK, let's try another approach. When you have row selection and postback on row click enabled for RadGrid:
RadGrid fires its server-side SelectedIndexChanged event:
You can use that to get to the selected items on the server. If this is not what you meant, or what you need, can you explain further?
All the best,
Veli
the Telerik team
OK, let's try another approach. When you have row selection and postback on row click enabled for RadGrid:
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
ClientEvents
OnRowSelected
=
"onRadGridPersonVIEW_RowSelected"
/>
</
ClientSettings
>
RadGrid fires its server-side SelectedIndexChanged event:
protected
void
RadGrid1_SelectedIndexChanged(
object
sender, EventArgs e)
{
foreach
(GridDataItem selectedItem
in
RadGrid1.SelectedItems)
{
//...
}
}
You can use that to get to the selected items on the server. If this is not what you meant, or what you need, can you explain further?
All the best,
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Mauricio Chotocruz
Top achievements
Rank 2
answered on 12 Aug 2010, 09:58 PM
Hi,
I open a radwindow, from this window i want to refresh the grid that is in the parent window. Something like this:
Parent Window:
Child Window:
When I selected a row in the rg_Extractos RadGrid, I show the rg_Descriptores RadGrid. When I closed the child window, the rg_Extractos.SelectedValue contains the DatakeyValue of the Row selected. But this only works fine in Internet Explorer.
I hope you understand...
I open a radwindow, from this window i want to refresh the grid that is in the parent window. Something like this:
Parent Window:
RadGrid:
...
<ClientSettings>
<Selecting AllowRowSelect=
"True"
/>
<ClientEvents OnRowClick=
"RowClick"
/>
</ClientSettings>
.......
Javascript:
function RefrescaGrid()
{
$find(
"<%= RadAjaxManager.GetCurrent(Page).ClientID %>"
).ajaxRequest();
}
.......
VB:
Protected
Sub
Page_Init(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Init
Dim
RadAjaxManager1
As
RadAjaxManager =
CType
(Master.FindControl(
"RadAjaxManager1"
), RadAjaxManager)
Dim
handler
As
New
RadAjaxControl.AjaxRequestDelegate(
AddressOf
Me
.WebUserControl_AjaxRequest)
AddHandler
RadAjaxManager1.AjaxRequest, handler
End
Sub
Sub
WebUserControl_AjaxRequest(
ByVal
sender
As
Object
,
ByVal
e
As
AjaxRequestEventArgs)
Dim
vlbo_Expediente
As
New
ExpedienteBO
Try
rg_Descriptores.DataSource = vlbo_Expediente.ObtieneCamposDescriptor(rg_Extractos.SelectedValue)
rg_Descriptores.DataBind()
Catch
ex
As
Exception
Finally
vlbo_Expediente =
Nothing
End
Try
End
Sub
Protected
Sub
Page_PreRender(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.PreRender
Dim
RadAjaxManager1
As
RadAjaxManager =
CType
(Master.FindControl(
"RadAjaxManager1"
), RadAjaxManager)
RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, Panel1, RadAjaxLoadingPanel1)
End
Sub
Child Window:
<script type=
"text/javascript"
>
function CloseAndRebind() {
self.close();
window.opener.RefrescaGrid();
}
</script>
.......
' On a button I call the CloseAndRebind javascript function:
ClientScript.RegisterStartupScript(Page.
GetType
(),
"mykey"
,
"CloseAndRebind();"
,
True
)
When I selected a row in the rg_Extractos RadGrid, I show the rg_Descriptores RadGrid. When I closed the child window, the rg_Extractos.SelectedValue contains the DatakeyValue of the Row selected. But this only works fine in Internet Explorer.
I hope you understand...
0
Hello Mauricio,
When you rebind the grid, its data items are recreated and restored to their default state, so you lose the selection so far. If you want to preserve the selected items, you will have to save their data key values before rebinding the grid and restoring their Selected state on PreRender after the grid is rebound.
To rebind a parent grid from a child window, you can get RadWindow instance from the child window and call the $find() method of the BrowserWindow to find the RadGrid component in the parent window. For example, most RadWindow and RadGrid examples have a GetRadWindow() function in the child window returning the RadWindow client object from the parent browser window. Using that, you can have:
Regards,
Veli
the Telerik team
When you rebind the grid, its data items are recreated and restored to their default state, so you lose the selection so far. If you want to preserve the selected items, you will have to save their data key values before rebinding the grid and restoring their Selected state on PreRender after the grid is rebound.
To rebind a parent grid from a child window, you can get RadWindow instance from the child window and call the $find() method of the BrowserWindow to find the RadGrid component in the parent window. For example, most RadWindow and RadGrid examples have a GetRadWindow() function in the child window returning the RadWindow client object from the parent browser window. Using that, you can have:
//GetRadWindow().BrowserWindow gives you the parent browser window object
//its $find() method will work to find client components in the parent window
//we can use that to find the RadGrid client component
var
parentGrid = GetRadWindow().BrowserWindow.$find(
"RadGrid1"
);
parentGrid.get_masterTableView().rebind();
//rebind the master table
Regards,
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Mauricio Chotocruz
Top achievements
Rank 2
answered on 17 Aug 2010, 09:01 PM
Hi Veli,
What I'm doing is "rg_Descriptores.DataBind()", no "rg_Extractos.DataBind()". I'm obtaining the value of the selected row of radgrid "rg_Extractos". As I said before everything works well in IE, but not in Chrome, Firefox and Safari.
rg_Descriptores is the "child" Radgrid.
Regards,
What I'm doing is "rg_Descriptores.DataBind()", no "rg_Extractos.DataBind()". I'm obtaining the value of the selected row of radgrid "rg_Extractos". As I said before everything works well in IE, but not in Chrome, Firefox and Safari.
rg_Descriptores.DataSource = vlbo_Expediente.ObtieneCamposDescriptor(rg_Extractos.SelectedValue)
rg_Descriptores.DataBind()rg_Descriptores is the "child" Radgrid.
Regards,
0
Hello Mauricio,
On 08/12 you said:
I open a radwindow, from this window i want to refresh the grid that is in the parent window.
Now, is it the other way? Can you, please, clarify, along with the exact steps you are taking and the result. Also state clearly what is not working and what are you getting - an error, unexpected values, nothing at all?
If you obtain the selected value of the parent window grid into the child window, how do you do that? From your code-behind:
I am left with the impression both grids are on one and the same page. Can you clarify these things.
Veli
the Telerik team
On 08/12 you said:
I open a radwindow, from this window i want to refresh the grid that is in the parent window.
Now, is it the other way? Can you, please, clarify, along with the exact steps you are taking and the result. Also state clearly what is not working and what are you getting - an error, unexpected values, nothing at all?
If you obtain the selected value of the parent window grid into the child window, how do you do that? From your code-behind:
rg_Descriptores.DataSource = vlbo_Expediente.ObtieneCamposDescriptor(rg_Extractos.SelectedValue)
rg_Descriptores.DataBind()
I am left with the impression both grids are on one and the same page. Can you clarify these things.
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Mauricio Chotocruz
Top achievements
Rank 2
answered on 19 Aug 2010, 04:54 PM
Hello,
Yes, both grids are on the same page. I have a button that open a child Window, from this child Window I want to refresh the Grid2 (rg_Descriptores) counting on the actual selected row on the Grid1 (rg_Extractos).
I get the actual selected row of the Grid1 (rg_Extractos) on Internet Explorer but not in Chrome, FireFox and Safari.
I hope you understand me...
Regards,
Yes, both grids are on the same page. I have a button that open a child Window, from this child Window I want to refresh the Grid2 (rg_Descriptores) counting on the actual selected row on the Grid1 (rg_Extractos).
I get the actual selected row of the Grid1 (rg_Extractos) on Internet Explorer but not in Chrome, FireFox and Safari.
I hope you understand me...
Regards,
0
Hello Mauricio,
Attaching a test page to demonstrate this scenario.
Veli
the Telerik team
Attaching a test page to demonstrate this scenario.
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items