or
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
| <%@ 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" dir="rtl"> |
| <head runat="server"> |
| <title>Numeric Pager RTL Test</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div dir="rtl"> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"/> |
| <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="5" Skin="Vista" AllowPaging="True" ShowGroupPanel="True" Width="100%"> |
| <PagerStyle AlwaysVisible="True" Mode="NumericPages" PageButtonCount="5" /> |
| <MasterTableView CommandItemDisplay="Top" Dir="RTL"/> |
| </telerik:RadGrid> |
| </div> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Data; |
| using System.Globalization; |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-SA"); |
| DataSet ds = new DataSet("NumericPagerDataSet"); |
| DataTable dt = new DataTable("GridTable"); |
| dt.Columns.Add("Id", System.Type.GetType("System.String")); |
| ds.Tables.Add(dt); |
| for (int i = 0; i < 10; i++) |
| { |
| DataRow dr = dt.NewRow(); |
| dr.SetField("Id", i.ToString()); |
| dt.Rows.Add(dr); |
| } |
| RadGrid1.DataSource = ds; |
| RadGrid1.DataBind(); |
| } |
| } |

| Imports Telerik.Web.UI |
| Partial Class dropdowninformtemplate |
| Inherits System.Web.UI.Page |
| Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated |
| If e.Item.ItemType = Telerik.Web.UI.GridItemType.EditFormItem And e.Item.IsInEditMode Then |
| Dim item As GridEditFormItem |
| item = e.Item |
| Dim ddl As DropDownList = CType(item.FindControl("ddl1"), DropDownList) |
| Dim cmb As RadComboBox = item.FindControl("cmb") |
| AddHandler ddl.SelectedIndexChanged, AddressOf ddl1_SelectedIndexChanged |
| ddl.DataSource = DataConnection.GetDataTable("select * from products") |
| ddl.DataTextField = "productname" |
| ddl.DataValueField = "productid" |
| ddl.DataBind() |
| End If |
| End Sub |
| Protected Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) |
| 'populate ddl2 |
| End Sub |
| Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand |
| If e.Item.IsInEditMode Then |
| Dim item As GridEditFormItem |
| item = CType(e.Item, GridEditFormItem) |
| Dim ddl2 As DropDownList = item.FindControl("ddl2") |
| End If |
| End Sub |
| Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource |
| RadGrid1.DataSource = DataConnection.GetDataTable("select * from customers") |
| End Sub |
| End Class |
| Imports Microsoft.VisualBasic |
| Imports System.Data |
| Imports System.Data.SqlClient |
| Public Class DataConnection |
| Public Shared Function GetDataTable(ByVal query As String) As DataTable |
| Dim ConnString As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString |
| Dim conn As SqlConnection = New SqlConnection(ConnString) |
| Dim adapter As SqlDataAdapter = New SqlDataAdapter |
| adapter.SelectCommand = New SqlCommand(query, conn) |
| Dim table1 As New DataTable |
| conn.Open() |
| Try |
| adapter.Fill(table1) |
| Finally |
| conn.Close() |
| End Try |
| Return table1 |
| End Function |
| End Class |
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="dropdowninformtemplate.aspx.vb" |
| Inherits="dropdowninformtemplate" %> |
| <%@ 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></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| <MasterTableView EditMode="EditForms"> |
| <Columns> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template"> |
| <FormTemplate> |
| <asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true"> |
| </asp:DropDownList> |
| <asp:DropDownList ID="ddl2" runat="server"> |
| </asp:DropDownList> |
| </FormTemplate> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </div> |
| </form> |
| </body> |
| </html> |
Hello,
When I create a Web Server Control with RadAjaxManager, RadAjaxLoadingPanel and RadGrid inside, all working properly, but if for example I change page on RadGrid, Ajax works fine, but on second time I change the page, Ajax stops working, and the third time I change page, Ajax works fine again...
I don't understand why this append
My code here...
| using System; |
| using System.Collections.Generic; |
| using System.ComponentModel; |
| using System.Linq; |
| using System.Text; |
| using System.Web; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| using System.IO; |
| using System.Reflection; |
| using darwin.sadj.shared.core; |
| [assembly: WebResource("darwin.sadj.shared.ui.etiqueta.Imagens.delete.gif", "image/gif")] |
| namespace darwin.sadj.shared.ui.etiqueta |
| { |
| [ToolboxData("<{0}:ListEtiqueta runat=server></{0}:ListEtiqueta>")] |
| public class ListEtiqueta : WebControl |
| { |
| private RadGrid gridEtiquetas { get; set; } |
| private RadAjaxManager RadAjaxManager1 { get; set; } |
| private RadAjaxLoadingPanel RadAjaxLoadingPanel1 { get; set; } |
| protected override void OnInit(EventArgs e) |
| { |
| this.Controls.Clear(); |
| RadAjaxLoadingPanel1 = new RadAjaxLoadingPanel(); |
| RadAjaxLoadingPanel1.ID = this.ID + "_RadAjaxLoadingPanel"; |
| this.Controls.Add(RadAjaxLoadingPanel1); |
| RadAjaxManager1 = new RadAjaxManager(); |
| RadAjaxManager1.ID = this.ID + "_RadAjaxManager"; |
| this.Controls.Add(RadAjaxManager1); |
| gridEtiquetas = new RadGrid(); |
| gridEtiquetas.ID = this.ID + "_gridEtiquetas"; |
| gridEtiquetas.NeedDataSource += new GridNeedDataSourceEventHandler(gridEtiquetas_NeedDataSource); |
| gridEtiquetas.ItemCommand += new GridCommandEventHandler(gridEtiquetas_ItemCommand); |
| this.Controls.Add(gridEtiquetas); |
| base.OnInit(e); |
| } |
| protected override void RenderContents(HtmlTextWriter output) |
| { |
| if (this.Visible == true) |
| { |
| this.RadAjaxLoadingPanel1.RenderControl(output); |
| this.RadAjaxManager1.RenderControl(output); |
| this.gridEtiquetas.RenderControl(output); |
| } |
| } |
| protected override void OnLoad(EventArgs e) |
| { |
| if (!this.Page.IsPostBack) |
| { |
| GridBoundColumn colunaID = new GridBoundColumn(); |
| gridEtiquetas.Columns.Add(colunaID); |
| colunaID.DataField = "Id"; |
| colunaID.UniqueName = "Id"; |
| colunaID.HeaderText = "Id"; |
| GridBoundColumn colunaDescricao = new GridBoundColumn(); |
| gridEtiquetas.Columns.Add(colunaDescricao); |
| colunaDescricao.DataField = "Descricao"; |
| colunaDescricao.UniqueName = "Descricao"; |
| colunaDescricao.HeaderText = "Descrição"; |
| GridButtonColumn colunaDelete = new GridButtonColumn(); |
| gridEtiquetas.Columns.Add(colunaDelete); |
| colunaDelete.ButtonType = GridButtonColumnType.ImageButton; |
| colunaDelete.CommandName = "Delete"; |
| colunaDelete.ConfirmDialogType = GridConfirmDialogType.RadWindow; |
| colunaDelete.ConfirmText = "Deseja apagar este registo?"; |
| colunaDelete.ConfirmTitle = "Confirmação"; |
| colunaDelete.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "darwin.sadj.shared.ui.etiqueta.Imagens.delete.gif"); |
| colunaDelete.Text = "Apagar"; |
| colunaDelete.UniqueName = "colunaDelete"; |
| colunaDelete.ItemStyle.Width = Unit.Pixel(22); |
| } |
| gridEtiquetas.AutoGenerateColumns = false; |
| gridEtiquetas.GridLines = GridLines.None; |
| gridEtiquetas.MasterTableView.AllowCustomPaging = true; |
| gridEtiquetas.MasterTableView.AllowPaging = true; |
| gridEtiquetas.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrev; |
| gridEtiquetas.MasterTableView.DataKeyNames = new string[] { "Id" }; |
| RadAjaxManager1.AjaxSettings.AddAjaxSetting(gridEtiquetas, gridEtiquetas, RadAjaxLoadingPanel1); |
| base.OnLoad(e); |
| } |
| protected void gridEtiquetas_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| EtiquetaController controller = new EtiquetaController(); |
| int TotalRecords = 0; |
| ((RadGrid)source).DataSource = controller.getListEtiqueta(((RadGrid)source).MasterTableView.CurrentPageIndex, ((RadGrid)source).MasterTableView.PageSize, out TotalRecords); |
| ((RadGrid)source).MasterTableView.VirtualItemCount = TotalRecords; |
| } |
| protected void gridEtiquetas_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == "Delete") |
| { |
| EtiquetaController controller = new EtiquetaController(); |
| controller.deleteEtiqueta(Convert.ToInt64(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"])); |
| } |
| } |
| } |
| } |