Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
244 views
When i use SelectedIndexchanged in RadCombobox1(postback=true) to call a SQL query to change item in Radcombobox2.I want use RadAjaxLoadingPanel in that time.can you help me?thank you very much!
Nencho
Telerik team
 answered on 05 Jun 2014
12 answers
142 views
My grid contains items in sort order as per my custom logic.But when i am using filter option with contains property, my grid shows the items which are perfectly match at the top and then other items.

So my sort order concept not persisting so longer.

I want filtering without changing the order of items in grid.

Thanks in advance!
Angel Petrov
Telerik team
 answered on 05 Jun 2014
4 answers
397 views

Hi,

I've got a page with one Placeholder on it and nothing else. I've added the RadScriptManager and the RadGrid using the code below and the Paging works ok but the sorting doesn't?  No error is thrown. It shows the sorting icons in the column heading but does not actually do the sorting.

If I do exaclty the same using the Designer pages it all works fine. It's trying to do things programmatically that I can't get it to work.

 

default.aspx
==========
<%@ Page EnableEventValidation="false"  Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikGridExample._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">
<head runat="server">
    <title></title>
</head>
<body>
<asp:PlaceHolder runat="server" ID="ph"></asp:PlaceHolder>
</body>
</html>

default.aspx.cs
==============
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace TelerikGridExample
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {

                HtmlForm f1 = new HtmlForm();

                // script manager
                Telerik.Web.UI.RadScriptManager sm = new Telerik.Web.UI.RadScriptManager();
                sm.ID = "RadScriptManager1";

                // data source
                SqlDataSource ds = new SqlDataSource(@"Data Source=gbe-pc\express2008;Initial Catalog=Northwind;User ID=sa;Password=something", "SELECT categoryid, categoryname FROM [categories]");
                ds.ID = "SqlDataSource1";

                // rad grid
                Telerik.Web.UI.RadGrid rg = new Telerik.Web.UI.RadGrid();
                rg.ID = "RadGrid1";
                rg.PageSize = 5;
                rg.AllowPaging = true;
                rg.AllowSorting = true;
                rg.AutoGenerateColumns = false;
                rg.GroupingEnabled = true;
                rg.ClientSettings.AllowDragToGroup = true;
                rg.EnableViewState = false;

                // add some columns
                Telerik.Web.UI.GridBoundColumn c1 = new Telerik.Web.UI.GridBoundColumn();
                rg.MasterTableView.Columns.Add(c1);
                c1.DataField = "categoryid";
                c1.SortExpression = "categoryid";
                c1.UniqueName = "categoryid";
                c1.DataType = System.Type.GetType("System.Int32");
                c1.HeaderText = "categoryid";

                Telerik.Web.UI.GridBoundColumn c2 = new Telerik.Web.UI.GridBoundColumn();
                rg.MasterTableView.Columns.Add(c2);
                c2.DataField = "categoryname";
                c2.SortExpression = "categoryname";
                c2.UniqueName = "categoryname";
                c2.DataType = System.Type.GetType("System.String");
                c2.HeaderText = "categoryname";
               
                rg.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(rg_NeedDataSource);
                // add to controls to the ajax panel
                f1.Controls.Add(sm);
                f1.Controls.Add(ds);
                f1.Controls.Add(rg);

                ph.Controls.Add(f1);     
        }

        void rg_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            Telerik.Web.UI.RadGrid myrg = (Telerik.Web.UI.RadGrid)Page.FindControl("RadGrid1");
            myrg.DataSource = (SqlDataSource)Page.FindControl("SqlDataSource1");

        }

    }
}

 

Shinu
Top achievements
Rank 2
 answered on 05 Jun 2014
2 answers
68 views
I am using an edit form template. Editing a record is fine, but when I select the "add new record button", the paging moves about 14 pages (I am using 50 rows per page). After cancelling or saving the record, the paging stays at that new paging position. My sqldatasource is sorted desc by the identity field.  So I am no longer at the top (newest record). I even tried rebinding the grid after initializing(RadGrid.InitInsertCommandName). Why does the act of initializing the insert do this? Very strange, but I'm sure one of you know what I am doing wrong.

Tom
Princy
Top achievements
Rank 2
 answered on 05 Jun 2014
3 answers
489 views
I've got RadCombobox with Itemtemplate (an anchor  element)  which is inside GridtemplateColumn of RadGrid. This RadCombobox has this properties set -  EnableLoadOnDemand="true" DataSourceID="ObjectDataSourceDrob" so  in RadGridLang_Loadevent  when I get to the point             pRadGridLang.DataBind();   myradcombobox is populated.

My question is is there any way I can create dynamically this Itemtemplate od radcombobox dynamically and populate it with data
Thank you

Here is my aspx page

  <telerik:RadGrid ID="RadGridLang" runat="server" AutoGenerateColumns="False"  EnableEmbeddedSkins="False"  RegisterWithScriptManager=false 
                 DataTextField="Descr" DataValueField="LanImg"
                Height="100%" Width="120px" AppendDataBoundItems="true" CellSpacing="0" GridLines="None" OnLoad="RadGridLang_Load">
                <MasterTableView>
                    <Columns>
                        <telerik:GridTemplateColumn DataField="LanCd">
                            <ItemTemplate>
                                <img src="<%#DataBinder.Eval(Container.DataItem, "LanImg")%>" alt="ASP.NET hosting" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="LanCd">
                            <ItemTemplate>
                                <telerik:RadComboBox ID="RadComboBoxLang" runat="server" EmptyMessage="Select a language" DataTextField="Descr" DataValueField="LanCd" EnableEventValidation="true"  RegisterWithScriptManager=false 
                                    EnableLoadOnDemand="true" DataSourceID="ObjectDataSourceDrob" CausesValidation="false" AllowCustomText="true" AppendDataBoundItems="true" OnLoad="RadComboBoxLang_Load">
                                     <ItemTemplate>
                                        <div class="imageWrap">
                                           <<telerik:RadComboBoxItem Text="Select" />
                                            <a id='myhref' href='/<%#DataBinder.Eval(Container.DataItem, "Controller")%>/<%#DataBinder.Eval(Container.DataItem, "Action")%>/<%# Eval("LanCd") %>/<%#DataBinder.Eval(Container.DataItem, "menuID")%>'>
                                            <img src="<%#DataBinder.Eval(Container.DataItem, "LanImg")%>" alt='<%# Eval("Descr")%>'/>&nbsp&nbsp&nbsp&nbsp&nbsp<%#DataBinder.Eval(Container.DataItem, "Descr")%></a>
                                        </div>
                                       
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
                                                                                   
   



  <asp:ObjectDataSource ID="ObjectDataSourceDrob" runat="server" SelectMethod="GetWebLanguage" TypeName="MvcBeaDAL.WebServiceBea">
        <SelectParameters>
            <asp:Parameter DefaultValue="" Name="id" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

Here is my code 

protected void RadComboBoxLang_Load(object sender, EventArgs e)
        {
            String pRequest = pGetLang; 
           RadComboBox radComboBoxLang = sender as RadComboBox;
           

            radComboBoxLang.SelectedValue = pRequest.ToUpper();
            bool p_test = MvcBeaDAL.CookiesManager.SetGetCookie(radComboBoxLang.SelectedValue);
        }
        protected void RadGridLang_Load(object sender, EventArgs e)
        {
            String pRequest = GetLang();
            pGetLang = pRequest;
            
            RadGrid pRadGridLang = this.FindControl("RadGridLang") as RadGrid;
            List<LanguageHost> radLang = new List<LanguageHost>();
            radLang.Add( MvcBeaDAL.WebServiceBea.GetWebLanguageID(pRequest));
           
            pRadGridLang.DataSource = radLang.ToList();
            pRadGridLang.DataBind();
        }
 
 
Shinu
Top achievements
Rank 2
 answered on 05 Jun 2014
3 answers
80 views
I have a Radgrid in an Update Panel. It has a template for "Add new Record". This template has a dropdownlist and a RadAsyncUpload control in a panel. When a value is selected from the dropdown and a file is uploaded, the Upload button is enabled. Else it is disabled.  For this I have a javascript function as follows:
function SetUploadButtonEnabled(controlPanel, fileUploadId) {
     var docTypesList = controlPanel.find("select");
     var gotListVal = docTypesList.val() != "";
     var fileUpload = $find(fileUploadId);
     var gotFileVal = fileUpload.getUploadedFiles().length > 0;
     var enable = gotListVal && gotFileVal;
     if (enable) {
         controlPanel.find(".GxButtonBlue").removeAttr("disabled");
     }
     else {
         controlPanel.find(".GxButtonBlue").attr("disabled", true);
     }
 }
I am trying to call it from code behind as follows, but the function is not being called:
string script = "<script type=\"text/javascript\">"
                + "\n  $(document).ready(function (){"
                    + "\n    $(document).on(\"change\", \"#" + this._DdDocumentTypes.ClientID + "\", function(event){"
                    + "\n      var docUploadControlPanel = $(this).closest(\"#" + this._DocUploadControlPanel.ClientID + "\");"
                    + "\n      SetUploadButtonEnabled(docUploadControlPanel, \"" + this._fiInput.ClientID + "\");"
                    + "\n    });"
                    + "\n  });"
                    + "\n "
                    + "</script>";
 
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DocumentAjaxUploadCtrlScript_" + this.ClientID, script);
Since an Update Panel is there I even tried:
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "DocumentAjaxUploadCtrlScript_" + this.ClientID, script, true);

But the javascript function is never called! Can you suggest a solution?
Shinu
Top achievements
Rank 2
 answered on 05 Jun 2014
1 answer
130 views

Hi,

I have two questions here.

I am using a RADGRID and when ME.LOADComplete event is happening I run a procedure which will filter the RAD Grid - roughly about 200 rows by default from the SQL View, it then goes down to about 20 results. The query takes less than 0 seconds to run on SQL Management studio. It takes about 1-2 seconds to display the page and filter the view.

In a different window, I am returning a view which has about 17,000 rows in it and takes about 4 seconds to run in SQL Management Studio but then it takes about 14 seconds to display and filter the page. It takes about 8 seconds to load without being filtered. Both RADGRIDs has the data source set in the ASPX page but I was wondering is there not a more efficient way to filter it first and then if the user changes the filter, it will apply accordingly? The number of results would be about 400 or so. I was thinking I need to use OnNeedDataSource and filter directly from SQL instead of the programmatically way of
rgCompanyTickets.MasterTableView.FilterExpression = strFilter
rgCompanyTickets.Rebind()

My other issue is that, in the RADGRID I have added a new column so the user can check the box and when the user presses a button on the screen, it displays a  RadWindow which says enter comment and click a button so that it can update the db. The issue I am facing is that when the page gets loaded from the first button click is that it is removing the state the checkboxes are in. So when I press the 2nd button, it doesn't know what rows I have selected before the post back. I believe the reason why it is doing this is due to me using the rebind statement during the filter process.

Do you know guys have any solutions or ideas about this?

<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="False" >
        <ItemTemplate>
          <asp:CheckBox ID="CheckBox1" runat="server"
          />
        </ItemTemplate>
        <HeaderTemplate>
          <asp:CheckBox ID="headerChkbox" runat="server"
      />
        </HeaderTemplate>
      </telerik:GridTemplateColumn>



Thanks,
Alex


Princy
Top achievements
Rank 2
 answered on 05 Jun 2014
3 answers
75 views
Hi,
Currently I have a 'add' button on a webform.

When clicked, a RadWindowsManager dialog window is displayed.

Clicking 'save' in that dialog, closes the dialog, adds a record to database table, and uses the client 'RefreshGrid' to update a grid on-screen with that extra record.

This all works fine- thanks to the great Telerik documentation!

However, as the record is added to the bottom of the grid, I would like the client to automatically scroll to the bottom.

I've tried using javascript before and after the '_doPostBack' call in 'refreshGrid', but the browser ignores it.

Do you have any suggestions?

Thanks,
Steve
Princy
Top achievements
Rank 2
 answered on 05 Jun 2014
1 answer
85 views
Hello,

My data source looks like:
RadGrid1.DataSource = TubesLoad;
where TubesLoad is ObservableCollection from my dll(from references).

I know, what i mast handle events RadGrid1_ItemUpdated, RadGrid1_ItemCreated etc. for each action with dataGrid. But i can't find the way to update data in my collection using Telerik.
Can u help me?

Thanks.
Ivan.
Ivan
Top achievements
Rank 1
 answered on 05 Jun 2014
1 answer
443 views
I have try to use CustomValidator with telerik:RadTextBox but it is not fired?

​<telerik:RadTextBox ID="rtbTelefon" MaxLength="50" Width="220px" EmptyMessage="Telefon" ToolTip="Telefon" runat="server" /><telerik:RadTextBox ID="rtbEpost" MaxLength="50" Width="230px" EmptyMessage="E-postadress" ToolTip="E-postadress" runat="server" /> <asp:CustomValidatorid="AtLeastOneContact" ClientValidationFunction="AtLeastOne_ClientValidate"Display="None" ErrorMessage="Telefon <b>eller</b> e-post krävs!"   SetFocusOnError="True"runat="server" />


And in telerik:RadScriptBlock
function AtLeastOne_ClientValidate(source, args) {
    if (document.getElementById("<%= rtbTelefon.ClientID %>").value == "" &&
        document.getElementById("<%= rtbEpost.ClientID %>").value == "") {
        args.IsValid = false;
    }
    else {
        args.IsValid = true;
    }
}


Nothing happand, but if i change to <asp:TextBox it works??
Why does it not work with telerik:RadTextBox?












Shinu
Top achievements
Rank 2
 answered on 05 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?