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

[Solved] select row client/server side

10 Answers 380 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Support ATT
Top achievements
Rank 1
Support ATT asked on 06 Jun 2008, 02:42 PM
hi

I have an datagrid inside an radajaxpanel.

This way worked for me perfect, until i update to the newest telerik component.

i select the grid client side with this command:

e.Item.Attributes.Add("onclick","javascript:__doPostBack('myClick'," + e.Item.ItemIndex + ");" );

It performs server side an postback, which i can get the information from the selected row !

But today, when i use this, sometimes an alert window occures in IE. This site could not be displayed. Any idea ???
I'm sure, something with radajaxpanel and __doPostPack(...) makes some problem.




protected
void TeilnehmerTable_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if( (e.Item.ItemType == ListItemType.Item) ||

(e.Item.ItemType ==

ListItemType.AlternatingItem) ||

(e.Item.ItemType ==

ListItemType.SelectedItem) )

{

e.Item.Attributes.Add(

"onmouseover","this.style.cursor='hand'");

e.Item.Attributes.Add(

"onclick","javascript:__doPostBack('myClick'," + e.Item.ItemIndex + ");" );

}


10 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 09 Jun 2008, 01:32 PM
Hello Toprak,

Unfortunately I was not able to replicate the issue in my local tests. Can you please check whether this happens only under a particular version of IE or is cross-browser issue? Also verify whether the behavior is the same when you move the grid outside of the ajax panel.

Furthermore, note that you can attain the same functionality intercepting the OnRowClick client event of RadGrid (where eventArgs.get_itemIndexHierarchical() will return the index of the item) and settings ClientSettings -> EnablePostBackOnRowClick to true.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 20 Jun 2008, 12:00 PM
Hi

have i also the RowClick server side ?

i have to call a method for rebuild an other table, when a row is clicked !
0
Sebastian
Telerik team
answered on 20 Jun 2008, 12:44 PM
Hi Toprak,

With EnablePostBackOnRowClick = true setting you can handle the row click server side intercepting the ItemCommand event. Review this online demo for more details:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Client/PostbackOnClientRowClick/DefaultCS.aspx

Regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 20 Jun 2008, 02:11 PM
Ok, this works fine.

But i miss the "cursor" hand, when i'm with over the items. is this also possible to enable ?
0
Sebastian
Telerik team
answered on 23 Jun 2008, 10:18 AM
Hi Toprak,

In order to change the mouse cursor when hovering over grid items, consider the solution presented in this code library thread:

http://www.telerik.com/community/code-library/submission/b311D-emhcd.aspx

Note that for the ASP.NET AJAX version of RadGrid (when using embedded skins) you will need to override the internal skin definition as explained in the following blog post:

http://blogs.telerik.com/DimoDimov/Posts/08-06-17/How_To_Override_Styles_in_a_RadControl_for_ASP_NET_AJAX_Embedded_Skin.aspx?ReturnURL=%2fDimoDimov%2fPosts.aspx

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 23 Jun 2008, 10:27 AM
Hi

I have an delete column in my datagrid. After delete action, i rebind the datagrid. this works fine.

But when i use: EnablePostBackOnRowClick =true, the datagrid doesn't show the updated table. the rows.count is correct, but the view is like, it hasn't be deleted the rows !!

but when i enter the page again, i can see the row is deleted.

The problem is EnablePostBackOnRowClick= true, after deleting a row, the row is also exists !!
0
Support ATT
Top achievements
Rank 1
answered on 25 Jun 2008, 08:07 AM
any idea ??
0
Sebastian
Telerik team
answered on 26 Jun 2008, 06:34 AM
Hi Toprak,

One possible solution would be to use the ItemCommand (in this case the CommandName will be RowClick), and rebind the control (invoking its Rebind() method)  - this should ensure that the information is refreshed. Also review the reply in the support ticket you started on this subject.

Regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 26 Jun 2008, 07:14 AM

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)

{

if (e.CommandName == "RowClick" && e.Item is Telerik.Web.UI.GridDataItem)

{

e.Item.Selected =

true;

showSelectedRejectionAlarms();

}

}

In the ItemCommand, i rebeind another related Datagrid, this works perfect.
But when i delete a row, i rebind also the mastertable, but nothing changes !!

protected void AlarmRejectionTable_DeleteCommand1(object source, Telerik.Web.UI.GridCommandEventArgs e)

{

...

...

//Rebind the Mastertable
AlarmRejectionTable.MasterTableView.Rebind();

//Nothing changes here, i can see also the selected Row. With EnablePostBackOnRowclick=false, everything works perfect. That means, the problem is not the deletecommand. The Problem is not refreshing the MasterTable, when Enablepostbackonrowclick is true !!

0
Sebastian
Telerik team
answered on 30 Jun 2008, 11:47 AM
Hi Toprak,

If you do not mind we will continue our communication in the support ticket you opened on this subject and will update this forum post once we come up with results.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Support ATT
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Support ATT
Top achievements
Rank 1
Share this question
or