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

Server side function not running

8 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 15 May 2015, 02:16 PM

Hi

 I have a RadGgrid witht he following template section:

<telerik:GridTemplateColumn HeaderText="Arrival" SortExpression="LocationArrival" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="LocationArrival">
<ItemTemplate>
<asp:CheckBox ID="chkActivityArrival" runat="server" AutoPostBack="True" visible="false" OnCheckedChanged="chkActivityArrival_CheckedChanged"/>
</ItemTemplate>
</telerik:GridTemplateColumn>

 

However when I click the checkbox the function chkActivityArrival_CheckedChanged on the server isn't being hit. The controls visibility is controlled in the code behind.

I have the same code n other grids and they work OK, what would be causing this..

Andy

8 Answers, 1 is accepted

Sort by
0
Andy Green
Top achievements
Rank 2
answered on 18 May 2015, 09:49 AM

Further to this, the problem is that the Grid_Load event is being fired. Not sure why as I hace checked the config and the running of similar grids that work ok.

On the working grinds the PageLoad is run, here I have if not page.ispostback so nothing is done, they then jump to the required routines to run.

On the problem grid after PageLoad it runs the Grid_Load.

 Andy

0
Andy Green
Top achievements
Rank 2
answered on 19 May 2015, 09:23 AM

More info

I have a comment in my code of the working grid:

Protected Sub rdGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rdGrid.NeedDataSource

'if enableviewstate is set to false this will always fire just after page load before anything else.
If Page.IsPostBack Then
            GridLoad()
End If

End Sub

I have the Grid EnableViewState="true"  on th working and non working grids, but one is firing needdatasource and one isn't

 Andy

0
Andy Green
Top achievements
Rank 2
answered on 19 May 2015, 02:31 PM

I have found what is going on but not why.

I have a function that runs on page load GetSelections() this loads up from the profile system user preferences its these preferences that are then used to load data into the grid.

These are the page load functions that run with the ActivityGrid Load beiong the routine that gets data and binds it to the grid.

The problem is the Grouping

        Local_ActivityGrouping = Profile("SiteGroupPreferences_" + SiteGroup_ID.ToString + ".ActivityGrouping")

'If Local_ActivityGrouping Then
' rdActivity.MasterTableView.GroupByExpressions.Add(New GridGroupByExpression(rdActivity.MasterTableView.GetColumnSafe("Activity")))
'Else
' rdActivity.MasterTableView.GroupByExpressions.Clear()
'End If

 

Why would presetting the grid groupby cause a NeedDataSource to be called when clicking on a checkbox within the grid.

Andy

0
Kostadin
Telerik team
answered on 20 May 2015, 07:07 AM
Hi Andy,

Note that each operation such as Filtering, Paging, Grouping, Sorting, etc. fires NeedDataSource event since those operations require fetching the data from the datasource. You can examine the following help article for more information.

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Andy Green
Top achievements
Rank 2
answered on 20 May 2015, 07:20 AM

Hi Kostadin

Read that several times, the problem is the Grouping being set in code, why once you group why does it still fire the needdatasource.

If I remove the grouping its fine.

Andy

0
Kostadin
Telerik team
answered on 25 May 2015, 05:39 AM
Hi Andy,

I am afraid I was unable to replicate the issue on my side. Generally NeedDataSource event will be fired only if you have changed the data or the grid structure. I prepared a small sample which demonstrates that the NeedDataSource is not fired after I checked/unchecked the CheckBox control. Please give it a try and let me know about the result.

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Andy Green
Top achievements
Rank 2
answered on 28 May 2015, 09:26 AM

Thanks Kostadin

I think I may have lead you down the wrong path here. I have been looking at this for a few days now, and the problem seems to be coming from the RadComboBox with checkboxes when a few are selected. I have a radCombo box with check boxes in my criteria for filtering the grid data.

If I select all it always fails but if I select 1 or 2 such that the message n item checked doesn't show the correct event is fired on the server. IE it doesn't run the needdatasource.

Is there an issue with the checkboxes in a combo box?

Andy

 

0
Angel Petrov
Telerik team
answered on 29 May 2015, 08:48 AM
Hi Andy,

I have already provided an answer regarding this issue in the official support ticket you have opened. In order to avoid duplicate posts I recommend that we continue our conversation there. Once the problem is resolved you can share your findings with he community thus helping other members resolve similar cases.

Regards,
Angel Petrov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Andy Green
Top achievements
Rank 2
Kostadin
Telerik team
Angel Petrov
Telerik team
Share this question
or