Hello, i've been having some problems with a radgrid EnablePostBackOnRowClick event, when this grid is in a web user control.
The reference to radajaxmanager is in the page that contains this webuser control.
It seems that the event only works one time, after the grid is filled, then it makes the ajax call and stops making the row selection.
And if the page changes... well it's does not work either.
Another problem.. but not critical, is that the loading panel is not showing when in an ajax call.
this is an example i've made:
here goes the code:
Main page testform.aspx:
testform.aspx.vb
radgrid.ascx
radgrid.ascx.vb
Thanks
The reference to radajaxmanager is in the page that contains this webuser control.
It seems that the event only works one time, after the grid is filled, then it makes the ajax call and stops making the row selection.
And if the page changes... well it's does not work either.
Another problem.. but not critical, is that the loading panel is not showing when in an ajax call.
this is an example i've made:
here goes the code:
Main page testform.aspx:
<%@ Page Language="vb" AutoEventWireup="false" codefile="testform.aspx.vb" Inherits="testform" %> |
<%@ Register src="radgrid.ascx" tagname="radgrid" tagprefix="uc1" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager runat="server" ID="scritpManager"></asp:ScriptManager> |
<telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="server" |
Style="width: 320px; padding-top: 125px;" Height="75px" Width="75px" > |
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading7.gif") %>' style="border:0;" /> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadAjaxManager ID="mainAjaxManager" runat="server" DefaultLoadingPanelID="LoadingPanel"> |
<AjaxSettings > |
<telerik:AjaxSetting AjaxControlID="btn"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="radgrid1" LoadingPanelID ="LoadingPanel"/> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="radgrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="radgrid1" LoadingPanelID ="LoadingPanel"/> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<asp:button ID="btn" runat="server" Text="clickMe to show/PopulateGrid" value="0" OnClick="doClick"/> |
<br/> |
<uc1:radgrid ID="radgrid1" runat="server" /> </form> |
</body> |
</html> |
testform.aspx.vb
Partial Public Class testform |
Inherits System.Web.UI.Page |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
End Sub |
Public Sub doCLick(ByVal sender As Object, ByVal e As System.EventArgs) |
radgrid1.populateGrid("BTN Click") |
End Sub |
End Class |
radgrid.ascx
<%@ Control Language="vb" AutoEventWireup="false" codefile="radgrid.ascx.vb" Inherits="radgrid_test" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<script language="javascript" type="text/javascript"> |
function doSomething(){ |
alert("Row_click"); |
} |
</script> |
Grid begins here |
<telerik:RadGrid id="list" AutoGenerateColumns="False" AllowPaging="True" |
PageSize="12" GridLines="None" Skin="Default" runat="server" BorderStyle="None" > |
<MasterTableView PageSize="12" AllowSorting="false" AllowPaging="true" GridLines="None" DataKeyNames="id" > |
<PagerStyle AlwaysVisible="True" Mode="NextPrevAndNumeric" PagerTextFormat="{2} to {3} of {5} records | {4}"></PagerStyle> |
<AlternatingItemStyle BackColor="LightGray"/> |
<Columns > |
<telerik:GridBoundColumn DataField="ref" HeaderText="ref" |
UniqueName="ref" Visible="true" > |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="desc" HeaderText="desc" |
UniqueName="desc" Visible="true"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="id" Visible="true" UniqueName="id" HeaderText="ID"></telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<ClientSettings EnablePostBackOnRowClick="true" > |
<Selecting AllowRowSelect="True" ></Selecting> |
<ClientEvents OnRowClick="doSomething"/> |
<ClientEvents/> |
</ClientSettings> |
</telerik:RadGrid> |
Grid Ends here |
<br /> |
Trace Events: |
<asp:TextBox runat="server" ID="debug" TextMode="MultiLine" Rows="10" Columns="60" EnableViewState="false" ></asp:TextBox> |
radgrid.ascx.vb
Imports System.Data |
Partial Public Class radgrid_test |
Inherits System.Web.UI.UserControl |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
If Not Page.IsPostBack And Not Page.IsAsync And Not Page.IsCallback Then |
debug.Text = "" |
End If |
End Sub |
Public Sub populateGrid(ByVal lvDebugString As String) |
debug.Text &= Chr(10) & lvDebugString |
Dim lvDataView As New DataView() |
Dim lvDataTable As New DataTable() |
Dim lvDataRow As DataRowView |
lvDataTable.TableName = "testing" |
lvDataTable.Columns.Add("ref") |
lvDataTable.Columns.Add("desc") |
lvDataTable.Columns.Add("id") |
lvDataView.Table = lvDataTable |
For lvI = 1 To 40 |
lvDataRow = lvDataView.AddNew() |
lvDataRow.Item("ref") = "test ref" |
lvDataRow.Item("desc") = "test desc" |
lvDataRow.Item("id") = lvI |
Next |
list.VirtualItemCount = 40 |
list.DataSource = lvDataView |
list.DataBind() |
End Sub |
Private Sub list_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles list.ItemCommand |
If (e.CommandName = "RowClick" AndAlso TypeOf e.Item Is Telerik.Web.UI.GridDataItem) Then |
e.Item.Selected = True |
debug.Text &= Chr(10) & "ItemCommand=" & e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("id") |
list.ClientSettings.EnablePostBackOnRowClick = True |
End If |
End Sub |
Private Sub list_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles list.PageIndexChanged |
list.CurrentPageIndex = e.NewPageIndex |
populateGrid("PageIndexChanged") |
End Sub |
End Class |
current RadControls for Asp.Net Ajax Version: 2007.3 1425
Thanks