Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
117 views
Hi friends ,

In our application we are binding grid on client side.
On binding the grid the records are not displying.I am not getting what's wrong in our code.
Bellow is the code i have written,

-----------------test.aspx -----------------------
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">      
 function pageLoad(sender, eventArgs) {          
          
           var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
           $find("<%= RadAjaxLoadingPanel1.ClientID %>").show("<%= RadGrid1.ClientID %>");
           PageMethods.GetData(0, tableView.get_pageSize(),
                tableView.get_sortExpressions().toString(), tableView.get_filterExpressions().toList(),
                    updateGrid);
                   
           PageMethods.GetCount(tableView.get_filterExpressions().toList(), updateVirtualItemCount);
       }
function updateGrid(result) {          
           var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
           tableView.set_dataSource(result);
           tableView.dataBind();          
 
           $find("<%= RadAjaxLoadingPanel1.ClientID %>").hide("<%= RadGrid1.ClientID %>");
          
        }
 function updateVirtualItemCount(result)
        {
           var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
           tableView.set_virtualItemCount(result);
        }
  function RadGrid1_Command(sender, args) {         
            args.set_cancel(true);                       
            var pageSize = sender.get_masterTableView().get_pageSize();
            var sortExpressions = sender.get_masterTableView().get_sortExpressions();
            var filterExpressions = sender.get_masterTableView().get_filterExpressions();           
            var currentPageIndex = sender.get_masterTableView().get_currentPageIndex();               
            if (args.get_commandName() == "Filter")
                currentPageIndex = 0;
            var sortExpressionsAsSQL = sortExpressions.toString();
            var filterExpressionsAsSQL = filterExpressions.toString();
            $find("<%= RadAjaxLoadingPanel1.ClientID %>").show("<%= RadGrid1.ClientID %>");
            PageMethods.GetData(currentPageIndex * pageSize, pageSize, sortExpressionsAsSQL, filterExpressions.toList(), updateGrid);         
          
        }
</script>

    </telerik:RadCodeBlock>

<telerik:RadScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" />
<telerik:RadGrid ID="RadGrid1" EnableViewState="false" runat="server" AllowPaging="true"
            AllowSorting="True" AllowFilteringByColumn="true" GridLines="None">
            <ItemStyle Wrap="false" />
            <MasterTableView AllowMultiColumnSorting="true" TableLayout="Fixed">
                <Columns>
                    <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" HeaderStyle-Width="100px"
                        FilterControlWidth="50px" />
                    <telerik:GridBoundColumn DataField="ENAME" HeaderText="ENAME" />
                    <telerik:GridBoundColumn DataField="SALARY" HeaderText="SALARY" />
                </Columns>
            </MasterTableView>
            <PagerStyle AlwaysVisible="true" Mode="NumericPages" />
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid1_Command"  />
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
-----------------test.aspx.cs -----------------------
[WebMethod]
    public static int GetCount(List<GridFilterExpression> filterExpressions)
    {
        int count = 0;

        using (SqlConnection connection =
            new SqlConnection(
                ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString))
        {           

            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append("SELECT COUNT(*) FROM Employee");        
          
            SqlCommand command = new SqlCommand(sqlBuilder.ToString(),
                    connection);

            parameters.ForEach(
                delegate(DbParameter parameter) { if (parameter != null) command.Parameters.Add(parameter); });

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                count = reader.GetInt32(0);
            }

            reader.Close();

        }
        return count;
    }

    [WebMethod]
    public static List<Employee> GetData(int startIndex, int maximumRows,
        string sortExpressions, List<GridFilterExpression> filterExpressions)
    {

        List<Employee> list = new List<Employee>();
        StringBuilder sqlBuilder = new StringBuilder();
        sqlBuilder.AppendLine(" SELECT * FROM Employee");     
        sqlBuilder.AppendLine(" Order By EID ASC");
        using (SqlConnection connection =
            new SqlConnection(
                ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString))
        {
            SqlCommand command = new SqlCommand(sqlBuilder.ToString(), connection);           
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            try
            {
                while (reader.Read())
                {
                    Employee newEmployee = new Employee();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        switch (reader.GetName(i))
                        {
                            case "SALARY":
                                newEmployee.SALARY  = reader.GetInt32(i);
                                break;
                            case "ENAME":
                                newEmployee.ENAME  = reader.GetString(i);
                                break;
                            case "EID":
                                newEmployee.EID  = reader.GetString(i);
                                break;                           
                            default:
                                break;
                        }
                    }
                    list.Add(newEmployee);
                }
            }
            finally
            {
                reader.Close();
            }
        }
        return list;
    }

public class Employee
    {
        private string _EID;
        private string _ENAME;
        private int _SALARY;  

        public Employee()
        {

        }
        public string EID
        {
            get
            {
                return this._EID;
            }
            set
            {
                if ((this._EID != value))
                {
                    this._EID = value;
                }
            }
        }

        public string ENAME
        {
            get
            {
                return this._ENAME;
            }
            set
            {
                if ((this._ENAME != value))
                {
                    this._ENAME = value;
                }
            }
        }

        public int SALARY
        {
            get
            {
                return this._SALARY;
            }
            set
            {
                if ((this._SALARY != value))
                {
                    this._SALARY = value;
                }
            }
        }
    
    }

 

 Thanks in advance
  Anwar


Anwar
Top achievements
Rank 2
 asked on 05 Jun 2012
0 answers
90 views

I have custom page in SP2010 where I have used RadEditor Control which is working in IE 8.0  but not working in IE 9.0.

In IE 9.0, its thowing error following error.

Error 1: When page load
Webpage error details

Message: Unable to get value of the property 'addEventListener': object is null or undefined

Error 2: When trying to choose option of custom context menu.
Message: Unable to get value of the property 'set_activePopup': object is null or undefined

Please reply as early as possible. Due to this issue, product release is on hold.

Please see the Telerik version detail in attached file.

Thanks in advance.

Regards,
Hitendra


Hitendra
Top achievements
Rank 1
 asked on 05 Jun 2012
1 answer
215 views
Hi,

I have a radcombobox which gets bind on the prerender event of the update panel which is its parent.

I have these properties set on the combobox
EnableLoadOnDemand="True"
ShowMoreResultsBox="True"
MarkFirstMatch="true"
EnableVirtualScrolling="true"
EmptyMessage="--- Choose ---"

After the initial load of the combobox the showmoreresultsbox does not show anything but just a dropdown arrow. After i type something in the combobox and when it filters it shows "Items 1-2 out of 2"

How can i get the text on the showmoreresultsbox on the initial load. I have these methods in my code behind file:

    Private Function GetData(ByVal test As String) As DataView
        Dim NewDataview As DataView

        NewDataview = DataViewTest

        NewDataview.RowFilter = "ElementName LIKE '" + test + "%'"

        Return NewDataview
    End Function

    Private Shared Function GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String
        If total <= 0 Then
            Return "No matches"
        End If

        Return [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total)
    End Function

    Protected Sub ddlElements_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlElements.ItemsRequested

        Dim data As DataTable = GetData(e.Text).ToTable

        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count

        ddlElements.Items.Clear()


        For i As Integer = itemOffset To endOffset - 1
            ddlElements.Items.Add(New RadComboBoxItem(data.Rows(i)("ElementName").ToString(), data.Rows(i)("GroupID").ToString()))
        Next

        e.Message = GetStatusMessage(endOffset, data.Rows.Count)
    End Sub
Ivana
Telerik team
 answered on 05 Jun 2012
2 answers
143 views
Hi,
I am using latest Telerik.Web.UI.dll (version 2012.1.501.40)
I have a RadScheduler and i set Height=100%
<telerik:RadScheduler ID="RadScheduler1" runat="server" Height="100%" OverflowBehavior="Scroll">
</telerik:RadScheduler>

the scroll bar is showing on IE8
but not showing on Chrome and Safari Browsers.
Am i missing anything?
Please find the screenshot attachments.

Ivana
Telerik team
 answered on 05 Jun 2012
5 answers
171 views
I have inserted a scheduler within a multipage which is associated with the radtabstrip.

Although the scheduler will come on to the screen when I click on the second tab, the scheduler is only showing approximatley 100px of height, even though I have manually set the scheduler to have a height of 500px .  Because my document background is formated in grey I can see a large portion of white space where the whole scheduler should be being displayed(which would make up the 500px).

 When I click on the "24 hour" / "day" / "Month" views the scheduler then fills in the white space.

If I drag and drop the calendar out of the Multipage it works fine so is there a problem with the UI or is there further configuration that I am missing?

Thanks,

JK
Justin
Top achievements
Rank 1
 answered on 05 Jun 2012
3 answers
593 views
Hi Telerik,

In my case, I want to show or hide any rows by clicking the link in template column in rad grid, click '+' to show the current row and '-' to hdie the current row.  And whatever the user chooses show or hide, keep the column that contians sign '+' and '-' to re-show and re-hide the current row. ( the UI is as shown below) How to achieve it? Look forward to your reply.

Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 05 Jun 2012
3 answers
369 views
We have a rather peculiar issue going on with the ajax loading panel.

First, the changes we did:

  • We have upgraded from Telerik Q3 2010 to Q3 2011
  • We have updated the solution from VS 2008 to VS 2010
  • We have also updated the project to use the .Net Framework version 4.0 from 2.0
  • The project is being published to a separate machine running on IIS 7 (previously was on IIS 6 on the same separate machine)
  • We are using a 64 bit application pool with integrated mode (previously was 32 bit classic mode)

When we run the aspx site from within Visual Studio, it works fine and the loading panel shows up as expected.

However when we publish to the other machine, that's when it looks odd.  The loading panel doesn't show at all (although the processing of the aspx page still appears to work).  Checking with fiddler also shows that the loading panel doesn't work (nothing is sent/received).

We have the following code in the aspx page:

<telerik:RadAjaxManager id="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnValidate">
                             <UpdatedControls>
                                   <telerik:AjaxUpdatedControl ControlID="divAll" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                               </UpdatedControls>
                </telerik:AjaxSetting>
           </AjaxSettings>
</telerik:RadAjaxManager>
 
 
<telerik:radAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" mindisplay="5000" ZIndex="10000">
     <asp:Image ID="Image2" runat="server" ImageUrl="../images/Loading3.gif" alt="loading..."  />
</telerik:radAjaxLoadingPanel>


We are not sure what else we might be missing?
Maria Ilieva
Telerik team
 answered on 05 Jun 2012
0 answers
59 views
I have an odd issue w/ my ajaxmanager - whenever it updates something, i get some odd text next to the controls I indicated that it updated  - attached is a screenshot.


what am I doing wrong?
Jeremy
Top achievements
Rank 1
 asked on 05 Jun 2012
1 answer
132 views
I have a page and clicking of a button opens a small RadWindow. Here the user makes some selections and clicks 'Generate' button. Now the server will start to stream a PDF file. Now radWindow.VisibleOnPageLoad = false does not work because the response stream is now PDF and not normal content type text/html

Is there a way to close the RadWindow in this case or is it a bug/limitation with Telerik RadWindow? 
Marin Bratanov
Telerik team
 answered on 05 Jun 2012
1 answer
116 views
Is the above possible ?

Essentially, i've got a collection of html anchor tags. I've set them to runat server and added their i'd to the target controls of the RadToolTipManager.

What i want to do is have each of these anchor tags cause an ajaxupdate request of the tooltipmanager and show the tooltip.
Each of the anchor tags has an id, which relates to an id in my database. I therefore want to query the database with this ID and pull out the appropiate information associated with the anchor tag.

The anchor tag enscapsulates an image, so if there's an easier way in which i should use a different control/element let me know.

Regards,

Alan
Marin Bratanov
Telerik team
 answered on 05 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?