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

No postbacks After RadGrid loads for the First Time

4 Answers 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BSL Support
Top achievements
Rank 1
BSL Support asked on 23 Mar 2010, 04:48 PM
Hi,

i have been working with radgrid for over a year and never came across this problem.
i have a custom query which i run and get a datatable and assign this as a data source to the grid.
it loads fine for the first time, but when i try to get different data on

SelectedIndexChanged event for a drop down, it doesnt trigger the postback event.
i have made sure the autopostback property is set to true on the drop down and i also made sure i am not loading the dropdown on postbacks.

i have a published page which works fine but when i try to run it on localhost it doesnt postback.

i have been trying to find a fix for two days and couldnt figure it out. can you kindly help me with this. its important i fix this soon.

thank you,

Murali

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 26 Mar 2010, 01:54 PM
Hello Murali,

I tried to replicate the issue which you described, but to no avail.
Attached to this post, you will find the code which I used for testing.

Please take a look at it and let me know if there are any differences at your end, which I may be leaving out.

Sincerely yours,
Mira
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
BSL Support
Top achievements
Rank 1
answered on 29 Mar 2010, 04:48 PM
Mira,

Thank you for your prompt reply, i have tested several scenarios with radgrid and different autopostback events and they all work fine.
But i have three webpages which have been working fine until last week but now they dont anymore and nothing has changed on those pages. For your better understanding i am going to attach code snipets ....  the page works just fine when i limit my query results to a few groups, but when i try to get all groups it fails. could you kindly work on this particular scenario with groups upto 41 and tell me what i am doing worng. Thank you very much, help is much apprciated.

Murali.

*************************  ASPX - Page *********************************

<%

@ Page Language="VB" MasterPageFile="~/MasterPages/WAN_MP.master" AutoEventWireup="false" CodeFile="MaintenanceExpenses.aspx.vb" Inherits="Reports_aspx_pages_MaintenanceExpenses" title="Maintenance Expenses" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<

 

asp:Content ID="Content1" ContentPlaceHolderID="MP_CPH1" Runat="Server">

 

 

<table>

 

 

<tr>

 

 

<td align="center" colspan="2">

 

 

<h3>Maintenance Expenses</h3>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<b>Year: </b> &nbsp;&nbsp;&nbsp;&nbsp;

 

 

<asp:DropDownList ID="ddl_year" runat="server" AutoPostBack="true">

 

 

</asp:DropDownList>

 

 

</td>

 

 

<td></td>

 

 

</tr>

 

 

<tr>

 

 

<td colspan="2">

 

 

<hr />

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td colspan="2">

 

 

<telerik:RadGrid ID="rg_ExpenseReport" AutoGenerateColumns="false" runat="server">

 

 

<MasterTableView>

 

 

<GroupByExpressions>

 

 

<telerik:GridGroupByExpression>

 

 

<SelectFields>

 

 

<telerik:GridGroupByField FieldAlias="Community" FieldName="Community"></telerik:GridGroupByField>

 

 

<telerik:GridGroupByField FieldAlias="MaintenanceType" FieldName="MaintenanceType"></telerik:GridGroupByField>

 

 

</SelectFields>

 

 

<GroupByFields>

 

 

<telerik:GridGroupByField FieldName="Community"></telerik:GridGroupByField>

 

 

<telerik:GridGroupByField FieldName="MaintenanceType"></telerik:GridGroupByField>

 

 

</GroupByFields>

 

 

</telerik:GridGroupByExpression>

 

 

</GroupByExpressions>

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="Community" Display="false" HeaderText="Community" />

 

 

<telerik:GridBoundColumn DataField="MaintenanceType" Display="false" HeaderText="Maintenance Type" />

 

 

<telerik:GridBoundColumn DataField="MaintenanceDesc" HeaderText="Maintenance Desc" />

 

 

<telerik:GridTemplateColumn UniqueName="TemplateColumn">

 

 

<HeaderTemplate>

 

 

<table id="Table1" style="font-size:small" cellspacing="1" cellpadding="1" width="100%" border="1">

 

 

<tr>

 

 

<td align="center" colspan="2">Jan</td>

 

 

<td align="center" colspan="2">Feb</td>

 

 

<td align="center" colspan="2">Mar</td>

 

 

<td align="center" colspan="2">Apr</td>

 

 

<td align="center" colspan="2">May</td>

 

 

<td align="center" colspan="2">Jun</td>

 

 

<td align="center" colspan="2">Jul</td>

 

 

<td align="center" colspan="2">Aug</td>

 

 

<td align="center" colspan="2">Sep</td>

 

 

<td align="center" colspan="2">Oct</td>

 

 

<td align="center" colspan="2">Nov</td>

 

 

<td align="center" colspan="2">Dec</td>

 

 

</tr>

 

 

<tr>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

<td>Actual</td>

 

 

<td>Variance</td>

 

 

</tr>

 

 

</table>

 

 

</HeaderTemplate>

 

 

<ItemTemplate>

 

 

<table id="Table2" style="font-size:xx-small" width="100%">

 

 

<tr>

 

 

<td title="Jan_Actual" style="width:4.16%"><%#Eval("Jan_Actual")%></td>

 

 

<td title="Jan_Variance" style="width:4.16%"><%#Eval("Jan_Variance")%></td>

 

 

<td title="Feb_Actual" style="width:4.16%"><%#Eval("Feb_Actual")%></td>

 

 

<td title="Feb_Variance" style="width:4.16%"><%#Eval("Feb_Variance")%></td>

 

 

<td title="Mar_Actual" style="width:4.16%"><%#Eval("Mar_Actual")%></td>

 

 

<td title="Mar_Variance" style="width:4.16%"><%#Eval("Mar_Variance")%></td>

 

 

<td title="Apr_Actual" style="width:4.16%"><%#Eval("Apr_Actual")%></td>

 

 

<td title="Apr_Variance" style="width:4.16%"><%#Eval("Apr_Variance")%></td>

 

 

<td title="May_Actual" style="width:4.16%"><%#Eval("May_Actual")%></td>

 

 

<td title="May_Variance" style="width:4.16%"><%#Eval("May_Variance")%></td>

 

 

<td title="Jun_Actual" style="width:4.16%"><%#Eval("Jun_Actual")%></td>

 

 

<td title="Jun_Variance" style="width:4.16%"><%#Eval("Jun_Variance")%></td>

 

 

<td title="Jul_Actual" style="width:4.16%"><%#Eval("Jul_Actual")%></td>

 

 

<td title="Jul_Variance" style="width:4.16%"><%#Eval("Jul_Variance")%></td>

 

 

<td title="Aug_Actual" style="width:4.16%"><%#Eval("Aug_Actual")%></td>

 

 

<td title="Aug_Variance" style="width:4.16%"><%#Eval("Aug_Variance")%></td>

 

 

<td title="Sep_Actual" style="width:4.16%"><%#Eval("Sep_Actual")%></td>

 

 

<td title="Sep_Variance" style="width:4.16%"><%#Eval("Sep_Variance")%></td>

 

 

<td title="Oct_Actual" style="width:4.16%"><%#Eval("Oct_Actual")%></td>

 

 

<td title="Oct_Variance" style="width:4.16%"><%#Eval("Oct_Variance")%></td>

 

 

<td title="Nov_Actual" style="width:4.16%"><%#Eval("Nov_Actual")%></td>

 

 

<td title="Nov_Variance" style="width:4.16%"><%#Eval("Nov_Variance")%></td>

 

 

<td title="Dec_Actual" style="width:4.16%"><%#Eval("Dec_Actual")%></td>

 

 

<td title="Dec_Variance" style="width:4.16%"><%#Eval("Dec_Variance")%></td>

 

 

</tr>

 

 

</table>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

</td>

 

 

</tr>

 

 

</table>

 

</

 

asp:Content>




************************ VB - Page ***********************************

 

Imports

 

IntranetDLL

 

Imports

 

System.Data

 

Imports

 

System.Media

 

Imports

 

Telerik.Web.UI

 

Imports

 

System.IO

 

Partial

 

Class Reports_aspx_pages_MaintenanceExpenses

 

 

Inherits System.Web.UI.Page

 

 

Dim utils As New Utilities

 

 

Dim clsmain As New clsMain

 

 

Dim clsdata As New clsData

 

 

Dim clscommunities As New clsCommunities

 

 

Dim clsaccounting As New clsAccounting

 

 

Dim glbl_props As New GlobalProperties

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

glbl_props =

CType(Session("Globals"), GlobalProperties)

 

clsmain.UserID = glbl_props.UserID

 

If Not IsPostBack Then

 

 

Dim dt As DataTable = clsmain.GetRefTypeValues("ReportYears")

 

utils.Load_Drop_Down_List(ddl_year, dt,

"Description", "ItemValue", "NULL")

 

 

End If

 

 

End Sub

 

 

Public Function CreateReport() As DataTable

 

 

Dim dt As DataTable = New DataTable

 

dt = clscommunities.mGetAllOpenCommunities()

 

Dim sFilter As String = "GL00100.actnumbr_2=090" 'All Maintenance expenses

 

 

Dim VarianceAmt As Decimal = 0.0, ActualAmt As Decimal = 0.0

 

 

Dim ExpenseDesc As String = "", ExpenseType As String = ""

 

 

Dim ReportName As String = "Expenses Report_" & clsmain.UserID

 

 

'Removing all old entries

 

clsdata.RunSQL(

"DELETE FROM tbl_rpt_Temp_Generic_2 WHERE UserName='" & ReportName & "'", "SEC")

 

 

Dim months As Integer = 12

 

 

If Date.Now.Year.ToString = ddl_year.SelectedValue Then

 

months =

Date.Now.Month

 

 

End If

 

 

For i As Integer = 0 To dt.Rows.Count - 1

 

 

For j As Integer = 1 To months

 

 

Dim query As String = ""

 

 

Dim dt_Expenses As DataTable = clsaccounting.GetGLAccountSummary(dt.Rows(i).Item("GPNum"), ddl_year.SelectedValue.ToString, j.ToString, False, sFilter)

 

 

If dt_Expenses.Rows.Count <> 0 Then

 

 

For k As Integer = 0 To dt_Expenses.Rows.Count - 1

 

 

Select Case dt_Expenses.Rows(k).Item("ACTNUMBR_1").ToString.Trim

 

 

Case "71950", "71800", "71850", "71700", "71600", "71400"

 

ExpenseType =

"Fixed Maintenance Expenses"

 

 

Case "71000", "71010", "71050", "71200", "72100"

 

ExpenseType =

"Controllable Maintenance Expenses"

 

 

Case Else

 

 

Continue For

 

 

End Select

 

ExpenseDesc = dt_Expenses.Rows(k).Item(

"ACTDESCR").ToString

 

ActualAmt = utils.CheckForNull(dt_Expenses.Rows(k).Item(

"PERDBLNC").ToString)

 

VarianceAmt = utils.CheckForNull(dt_Expenses.Rows(k).Item(

"BudgetTotal")) - utils.CheckForNull(dt_Expenses.Rows(k).Item("PERDBLNC"))

 

query = query &

" INSERT INTO tbl_rpt_Temp_Generic_2 (UserName,FieldText1,FieldText2,FieldText3,FieldText4,FieldDecimal1,FieldDecimal2) " _

 

&

" VALUES ('" & ReportName & "','" & dt.Rows(i).Item("CommunityShortName") & "','" & ExpenseType & "','" & ExpenseDesc & "','" & j & "'," & ActualAmt & "," & VarianceAmt & ")"

 

 

Next

 

clsdata.RunSQL(query,

"SEC")

 

 

End If

 

 

Next

 

 

Next

 

 

Dim sql As String = "SELECT FieldText1 as Community,FieldText2 as MaintenanceType,FieldText3 as MaintenanceDesc," _

 

&

"SUM(case When fieldtext4=1 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Jan_Actual," _

 

&

"SUM(case When fieldtext4=1 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Jan_Variance," _

 

&

"SUM(case When fieldtext4=2 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Feb_Actual," _

 

&

"SUM(case When fieldtext4=2 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Feb_Variance," _

 

&

"SUM(case When fieldtext4=3 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Mar_Actual," _

 

&

"SUM(case When fieldtext4=3 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Mar_Variance," _

 

&

"SUM(case When fieldtext4=4 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Apr_Actual," _

 

&

"SUM(case When fieldtext4=4 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Apr_Variance," _

 

&

"SUM(case When fieldtext4=5 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as May_Actual," _

 

&

"SUM(case When fieldtext4=5 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as May_Variance," _

 

&

"SUM(case When fieldtext4=6 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Jun_Actual," _

 

&

"SUM(case When fieldtext4=6 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Jun_Variance," _

 

&

"SUM(case When fieldtext4=7 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Jul_Actual," _

 

&

"SUM(case When fieldtext4=7 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Jul_Variance," _

 

&

"SUM(case When fieldtext4=8 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Aug_Actual," _

 

&

"SUM(case When fieldtext4=8 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Aug_Variance," _

 

&

"SUM(case When fieldtext4=9 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Sep_Actual," _

 

&

"SUM(case When fieldtext4=9 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Sep_Variance," _

 

&

"SUM(case When fieldtext4=10 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Oct_Actual," _

 

&

"SUM(case When fieldtext4=10 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Oct_Variance," _

 

&

"SUM(case When fieldtext4=11 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Nov_Actual," _

 

&

"SUM(case When fieldtext4=11 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Nov_Variance," _

 

&

"SUM(case When fieldtext4=12 THEN CONVERT(decimal (10,0),FieldDecimal1) ELSE Null END) as Dec_Actual," _

 

&

"SUM(case When fieldtext4=12 THEN CONVERT(decimal (10,0),FieldDecimal2) ELSE Null END) as Dec_Variance " _

 

&

"FROM tbl_rpt_Temp_Generic_2 WHERE UserName='" & ReportName & "' GROUP BY FieldText1,FieldText2,FieldText3"

 

 

Return clsdata.RunSQLReturnDT(sql, "SEC")

 

 

End Function

 

 


Protected
Sub ddl_year_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl_year.SelectedIndexChanged

 

rg_ExpenseReport.Rebind()

 

End Sub

 

 


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

 

 

Dim dt As DataTable = CreateReport()

 

rg_ExpenseReport.DataSource = dt

 

End Sub

 

End

 

Class

 

 

 

0
Mira
Telerik team
answered on 01 Apr 2010, 08:59 AM
Hello Murali,

I have examined your code and noticed that you have set the AutoEventWireup property to false.
Please enable it, so that the Handles keyword attaches events properly.

Regards,
Mira
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
Mira
Telerik team
answered on 01 Apr 2010, 09:00 AM
Hello Murali,

I have examined your code and noticed that you have set the AutoEventWireup property to false.
Please enable it, so that the Handles keyword attaches event handlers properly.

Regards,
Mira
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.
Tags
Grid
Asked by
BSL Support
Top achievements
Rank 1
Answers by
Mira
Telerik team
BSL Support
Top achievements
Rank 1
Share this question
or