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

breaking point kept hitting onclick event

3 Answers 12 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 29 Apr 2008, 06:31 PM
hi

I have this piece of code in the page load event:

im

dtType As New DataTable
Dim daType As New SqlDataAdapter
Dim sqlCmd As New SqlCommand("spSelect", x.getConn)
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.Parameters.Add(
New SqlParameter("@search", SqlDbType.NVarChar, 10)).Value = "All"
sqlCmd.Parameters.Add(New SqlParameter("@Type", SqlDbType.NVarChar, 10)).Value = "All"
daType.SelectCommand = sqlCmd
daType.Fill(dtCourse)
gridType.DataSource = dtType
gridType.DataBind()

This RADgrid has sorting enabled. I set a breakpoint at the page load event.

When the page was loading, yes indeed it hit the breakpoint and i press F11 to step into the code. But the strange thing is that it also step into this code:

<

ItemTemplate>
<a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"TypeCode")%>'); return false;">Update</a>
</ItemTemplate>

several times. Same thing would happen every time i did a sort. Why is that so and how to make sure it does not step into this: <a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"TypeCode")%>'); return false;">Update</a>
 

Thanks

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 01 May 2008, 07:37 AM
Hello Lui,

Indeed, in operations like sorting the control will rebind, causing a new page lifecycle to be executed, hence the behavior you observed. Here is a list of commands which would invoke Rebind implicitly for the control. Since you have located the code to populate the control with data in the PageLoad handler, you can consider moving it in the NeedDataSource handler, taking advantage of the AdvancedDataBinding model for the control.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
L
Top achievements
Rank 1
answered on 02 May 2008, 04:58 AM
Are there any good reference on using the NeedDataSource? Thanks
0
Yavor
Telerik team
answered on 02 May 2008, 07:35 AM
Hi,

You can find more information on the functionality in question in the following article, and a working example here. I hope this helps.

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
L
Top achievements
Rank 1
Answers by
Yavor
Telerik team
L
Top achievements
Rank 1
Share this question
or