Just another WordPress.com weblog

sample

<telerik:RadAjaxManager ID=”RadAjaxManager1″ runat=”server” RequestQueueSize=”5″>          <AjaxSettings>              <telerik:AjaxSetting AjaxControlID=”timer”>                  <UpdatedControls>                      <telerik:AjaxUpdatedControl ControlID=”RadGrid1″ LoadingPanelID=”RadAjaxLoadingPanel1″ />                      <telerik:AjaxUpdatedControl ControlID=”Label1″ />                      <telerik:AjaxUpdatedControl ControlID=”Label2″ />                  </UpdatedControls>              </telerik:AjaxSetting>              <telerik:AjaxSetting AjaxControlID=”RadGrid1″>                  <UpdatedControls>                      <telerik:AjaxUpdatedControl ControlID=”RadGrid1″ LoadingPanelID=”RadAjaxLoadingPanel1″ />                      <telerik:AjaxUpdatedControl ControlID=”Label1″ />                  </UpdatedControls>              </telerik:AjaxSetting>          </AjaxSettings>      </telerik:RadAjaxManager>     <asp:Timer ID=”timer” runat=”server” Interval=”5000″ ontick=”timer_Tick”></asp:Timer>         <asp:Label ID=”Label1″ runat=”server” Text=”Label”></asp:Label>              <asp:Label ID=”Label2″ runat=”server” Text=”Label”></asp:Label>     <telerik:RadAjaxLoadingPanel runat=”server” ID=”RadAjaxLoadingPanel1″ BackColor=”LightSeaGreen” >     <div style=”width:100%;height:100%”></div>     </telerik:RadAjaxLoadingPanel>              <div style=”width:1000px”>         <telerik:RadGrid ID=”RadGrid1″ runat=”server” Width=”100%” AllowPaging=”true” AllowSorting=”true” AutoGenerateColumns=”false”  OnPageIndexChanged=”RadGrid1_PageIndexChanged”              OnPageSizeChanged=”RadGrid1_PageSizeChanged”             OnSortCommand=”RadGrid1_SortCommand”                  AllowFilteringByColumn=”true” OnItemDataBound=”RadGrid1_ItemDataBound”>             <MasterTableView AutoGenerateColumns=”false” AllowFilteringByColumn=”True” ShowFooter=”True”>                 <Columns>                     <telerik:GridMaskedColumn DataField=”CustomerID” HeaderText=”CustomerID” FilterControlWidth=”50px”                         CurrentFilterFunction=”EqualTo” ShowFilterIcon=”true” UniqueName=”CustomerID”>                     </telerik:GridMaskedColumn>                     <telerik:GridBoundColumn FilterControlWidth=”120px” DataField=”CompanyName” HeaderText=”CompanyName”                         CurrentFilterFunction=”Contains” ShowFilterIcon=”true”>                     </telerik:GridBoundColumn>                     <telerik:GridBoundColumn FilterControlWidth=”120px” DataField=”ContactTitle” HeaderText=”ContactTitle”                         AutoPostBackOnFilter=”true” CurrentFilterFunction=”Contains” ShowFilterIcon=”true”>                     </telerik:GridBoundColumn>                     <telerik:GridBoundColumn FilterControlWidth=”120px” DataField=”Address” HeaderText=”Address”                         AutoPostBackOnFilter=”true” CurrentFilterFunction=”Contains” ShowFilterIcon=”true”>                     </telerik:GridBoundColumn>                     <telerik:GridBoundColumn FilterControlWidth=”120px” DataField=”Phone” HeaderText=”Phone”                         AutoPostBackOnFilter=”true” CurrentFilterFunction=”Contains” ShowFilterIcon=”true”>                     </telerik:GridBoundColumn>                 </Columns>             </MasterTableView>         </telerik:RadGrid>         </div>

——————————————–  protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 LoadDataForRadGrid1();                 Label1.Text = DateTime.Now.ToString(“dd/MM/yyyy hh:mm:ss tt”);             }              }

private void LoadDataForRadGrid1()         {             DataTable Source = new DataTable();             Source=(DataTable)Cache[“MyDataSet”];             if (Source == null)             {                 RadGrid1.DataSource = GetDataTable();                 Label2.Text = “dt”;             }             else             {                 RadGrid1.DataSource = Source;                 Label2.Text = “cache”;             }         }

public DataTable GetDataTable()         {

DataTable dt = new DataTable();             DataColumn dc = new DataColumn();             dc.ColumnName = “CustomerID”;             dc.DataType = typeof(string);             dt.Columns.Add(dc);

dc = new DataColumn();             dc.ColumnName = “CompanyName”;             dc.DataType = typeof(string);             dt.Columns.Add(dc);

dc = new DataColumn();             dc.ColumnName = “ContactTitle”;             dc.DataType = typeof(string);             dt.Columns.Add(dc);

dc = new DataColumn();             dc.ColumnName = “Address”;             dc.DataType = typeof(string);             dt.Columns.Add(dc);

dc = new DataColumn();             dc.ColumnName = “Phone”;             dc.DataType = typeof(string);

dt.Columns.Add(dc);             int i;

for (i = 0; i < 300; i++)             {                 dt.Rows.Add(new object[] { “1”+i, “Max”+i, “Hello my name is Max and I am software engineer.”, “Demo@Gmail.com“, “My Phone is 123456789” });                             }             Cache[“MyDataSet”] = dt;             TimeSpan freshness = new TimeSpan(0, 0, 0, 60);             DateTime now = DateTime.Now;             Response.Cache.SetExpires(now.Add(freshness));             Response.Cache.SetMaxAge(freshness);             Response.Cache.SetCacheability(HttpCacheability.Server);             Response.Cache.SetValidUntilExpires(true);             return dt;

}

protected void RadGrid1_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)         {             LoadDataForRadGrid1();         }         protected void RadGrid1_PageSizeChanged(object sender, Telerik.Web.UI.GridPageSizeChangedEventArgs e)         {             LoadDataForRadGrid1();         }         protected void RadGrid1_SortCommand(object sender, Telerik.Web.UI.GridSortCommandEventArgs e)         {             LoadDataForRadGrid1();         }

//protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)         //{         //    if (e.CommandName == RadGrid.FilterCommandName)         //    {         //        LoadDataForRadGrid1();         //        //Pair filterPair = (Pair)e.CommandArgument;         //        ////gridMessage1 = “Current Filter function: ‘” + filterPair.First + “‘ for column ‘” + filterPair.Second + “‘”;         //        //TextBox filterBox = (e.Item as GridFilteringItem)[filterPair.Second.ToString()].Controls[0] as TextBox;         //        ////gridMessage2 = “<br> Entered pattern for search: ” + filterBox.Text;         //        //LoadDataForRadGrid1();         //        //RadGrid1.MasterTableView.FilterExpression = “([” + filterPair.Second + “] LIKE \’%” + filterBox.Text+”%\’) “;         //        //GridColumn column = RadGrid1.MasterTableView.GetColumnSafe(filterPair.Second.ToString());

//        //column.CurrentFilterFunction = GridKnownFunction.Contains;         //        //column.CurrentFilterValue = filterBox.Text;         //    }         //}         //private string gridMessage1 = null, gridMessage2 = null;         //protected void RadGrid1_DataBound(object sender, EventArgs e)         //{         //    if (!string.IsNullOrEmpty(gridMessage1))         //    {         //        //Current Filter function: ‘StartsWith’ for column ‘CompanyName’         //        //Entered pattern for search: a          //        //DisplayMessage(gridMessage1);         //        //DisplayMessage(gridMessage2);

//        //            RadGrid1.MasterTableView.FilterExpression = “([ColumeUniqueName] = ” + ViewState(“ID”) + “)”;         //        //RadGrid1.Rebind();

//    }         //}         //private void DisplayMessage(string text)         //{         //    //RadGrid1.Controls.Add(new LiteralControl(string.Format(“<span style=’color:red’>{0}</span>”, text)));         //}

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)         {             if (e.Item is GridPagerItem)             {                 RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl(“PageSizeComboBox”);                 PageSizeCombo.Items.Clear();

PageSizeCombo.Items.Add(new RadComboBoxItem(“10”));                 PageSizeCombo.FindItemByText(“10”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“20”));                 PageSizeCombo.FindItemByText(“20”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“30”));                 PageSizeCombo.FindItemByText(“30”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“40”));                 PageSizeCombo.FindItemByText(“40”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“50”));                 PageSizeCombo.FindItemByText(“50”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“60”));                 PageSizeCombo.FindItemByText(“60”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.Items.Add(new RadComboBoxItem(“70”));                 PageSizeCombo.FindItemByText(“70”).Attributes.Add(“ownerTableViewId”, RadGrid1.MasterTableView.ClientID);

PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;             }         }         protected void timer_Tick(object sender, EventArgs e)         {             LoadDataForRadGrid1();             Label1.Text = DateTime.Now.ToString(“dd/MM/yyyy hh:mm:ss tt”);         }

Advertisements

Comments on: "sample" (1)

  1. Keep close friends and family around you. They will haunt you with your past. I suspect people sometime kept significant others around regardless just Click https://zhoutest.wordpress.com/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: