Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
208 views
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Data" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
<title>How to Change the TotalRowCount ...</title>
</head>
<body>
<form id="form1" runat="server">
<script runat="server" language="c#">
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        this.RadGrid1.DataSource = DataPage(0);
        this.RadGrid1.DataBind();
    }
}
public DataRow[] DataPage(int PageIndex)
{
    string sql = string.Empty;
    switch (this.RadComboBox1.SelectedValue)
    {
        case "2":
            sql = "pkID >= " + (PageIndex * 5 + 1) + " AND pkID <= " + (PageIndex * 5 + 5) + "";
            return dt2().Select(sql);
        default:
            sql = "pkID >= " + (PageIndex * 5 + 1) + " AND pkID <= " + (PageIndex * 5 + 5) + "";
            return dt1().Select(sql);
    }
}
protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    this.RadGrid1.DataSource = DataPage(this.RadDataPager1.CurrentPageIndex);
    this.RadGrid1.DataBind();
}
protected void RadDataPager1_PageIndexChanged(object sender, RadDataPagerPageIndexChangeEventArgs e)
{
    this.RadGrid1.DataSource = DataPage(e.NewPageIndex);
    this.RadGrid1.DataBind();
}
protected void RadDataPager1_TotalRowCountRequest(object sender, RadDataPagerTotalRowCountRequestEventArgs e)
{
    this.RadDataPager1.TabIndex = 1;
    switch (this.RadComboBox1.SelectedValue)
    {
        case "1":
            e.TotalRowCount = dt1().Rows.Count;
            break;
        case "2":
            e.TotalRowCount = dt2().Rows.Count;
            break;
    }
}
public static DataTable dt1()
{
    DataTable table = new DataTable();
    table.Columns.Add("pkID", typeof(Int32));
    table.Columns.Add("ParentID", typeof(Int32));
    table.Columns.Add("Name", typeof(String));
    table.Columns.Add("Text", typeof(String));
    table.Rows.Add(new object[] { 1, 1, "testName1", "testText1" });
    table.Rows.Add(new object[] { 2, 1, "testName2", "testText2" });
    table.Rows.Add(new object[] { 3, 1, "testName3", "testText3" });
    table.Rows.Add(new object[] { 4, 1, "testName4", "testText4" });
    table.Rows.Add(new object[] { 5, 1, "testName5", "testText5" });
    table.Rows.Add(new object[] { 6, 1, "testName6", "testText6" });
    table.Rows.Add(new object[] { 7, 1, "testName7", "testText7" });
    table.Rows.Add(new object[] { 8, 1, "testName8", "testText8" });
    table.Rows.Add(new object[] { 9, 1, "testName9", "testText9" });
    table.Rows.Add(new object[] { 10, 1, "testName10", "testText10" });
    table.Rows.Add(new object[] { 11, 1, "testName11", "testText11" });
    table.Rows.Add(new object[] { 12, 1, "testName12", "testText12" });
    return table;
}
public static DataTable dt2()
{
    DataTable table = new DataTable();
    table.Columns.Add("pkID", typeof(Int32));
    table.Columns.Add("Name", typeof(String));
    table.Rows.Add(new object[] { 1, "C" });
    table.Rows.Add(new object[] { 2, "C++" });
    table.Rows.Add(new object[] { 3, "C#" });
    table.Rows.Add(new object[] { 4, "Java" });
    table.Rows.Add(new object[] { 5, "F++" });
    table.Rows.Add(new object[] { 6, "Z++" });
    return table;
}
</script>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadComboBox1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                <telerik:AjaxUpdatedControl ControlID="RadDataPager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadDataPager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadDataPager1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="true" onselectedindexchanged="RadComboBox1_SelectedIndexChanged">
    <Items>
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="1" Selected="true" />
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="2" />
    </Items>
</telerik:RadComboBox>
<telerik:RadGrid ID="RadGrid1" runat="server" PageSize="5">
</telerik:RadGrid>
<telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="5" 
    ontotalrowcountrequest="RadDataPager1_TotalRowCountRequest" 
    onpageindexchanged="RadDataPager1_PageIndexChanged">
    <Fields>
        <telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" />
        <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="10" HorizontalPosition="RightFloat" />
        <telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" />
        <telerik:RadDataPagerGoToPageField CurrentPageText="" TotalPageText="/" TextBoxWidth="38" SubmitButtonText="Go" HorizontalPosition="RightFloat" />
    </Fields>
</telerik:RadDataPager>
</form>
</body>
</html>

this web application is correctly. just when i change RadComboBox Controls Item,
the TotalRowCount cannot be changed. how can i do ?
e.g.:
when the page load, default RadComboBox Item's Value is 1. then the current DataTable is dt1, the table's rows number is 12.
when i change RadComboBox to item 2. it's Value is 2,  the current DataTable is dt2. the table's rows number is 6.
but the RadDataPager's TotalRowCount still keep old value: 12 rows.

thanks.
Andrey
Telerik team
 answered on 01 Aug 2011
1 answer
81 views
Hi I'm working with th radgrid and I would like to know how can I implement google like filtering with entity framework. I have an EDM and with a linq query I fill my grid, I added the simple filtering functionally and works great, now I want to move forward and Implement google like filtering. How can I perform this? 
Genti
Telerik team
 answered on 01 Aug 2011
1 answer
84 views
I've ran into an issue where if i put a rad grid inside a jquery dialog it looses the on scroll event. if i take it out of the jquery dialog it works is there any way this an be reasigned? (if i ajax refresh the grid everything works as well). The Grid is wrapped in an ajax panel wrapped in a RadMultiPage which in turn is wrapped in the jquery dialog. any helop would be appreciated. Rafal
Pavlina
Telerik team
 answered on 01 Aug 2011
1 answer
75 views
Hi,

When hover at menu item on IE, menu gets opens upside if there is no enough room down side.
Is it possible to force menu to always open down ward in IE.

This is good on other browsers e.g. Mozila, Safari, Chrome, Opera.

Thanks and Regards,
Tabrez
Kate
Telerik team
 answered on 01 Aug 2011
2 answers
64 views
Is there a way to minimize the parent hierarchy when a child is selected? Our users want only the header of the parent record(s) to be displayed without showing the rest of the rows for that hierarchy level.

For example:
We want to not show the rows for Category 2 and Category 3 when Category 1's children are displayed.

 

  1. Category 1
    1. Category 1a
    2. Category 1b
  2. Category 2
  3. Category 3
Casey
Top achievements
Rank 1
 answered on 01 Aug 2011
0 answers
106 views
1. I have a Rad Progress Area in one of the pages of my application. When I try to set the Localization.UploadFiles, it is not being set. I always get the value that I have set at first.

2. If I try to end the current rad progress context using RadProgressContext.Current.OperationComplete command, I don't think the Rad Progress area is being stopped. I can still see that. Also the ScriptManager.RegisterStartUp script does not fire if the use of rad progress area is not stopped.
Haritha
Top achievements
Rank 1
 asked on 01 Aug 2011
4 answers
295 views
RadToolTipManager response error:
 Exception=Sys.WebForms.PageRequestManagerServerErrorException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Andrei
Top achievements
Rank 2
 answered on 01 Aug 2011
7 answers
111 views
I have a number of templates applied to provide property labels on certain nodes like below.  So that even when Property 2 for instance has no value, it's still labeled as such by the template.

Item1
   Property 1: Property1Value
   Property 2:
Item 2

This works fine when editing one of the property nodes that already has a value like Property 1.  But when editing an empty node like Property 2, instead of just showing a blank edit box, you would see the label in there like "Property 2:  ".  Then it passes the whole thing as the text in the event args to the NodeEdit handler rather than just the entered value.  So you get "Property 2: Prop2value" rather than just "Prop2Value".

I've tried it like below and also breaking out the wrapping tag for the value into a second label and setting the DataBinding handler on that.  I get the same result either way.  Am I missing something or is this a bug?


public class Property2Template : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Label label1 = new Label();
        RadTreeNode node = (RadTreeNode)container;
        label1.Text = "Property 2: <span class=\"PropertyValue\">" + node.Text + "</span>";
        label1.CssClass = "PropertyLabel";
        container.Controls.Add(label1);
    }
}

also

public class Property2Template : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Label label1 = new Label();
        Label label2 = new Label();
        RadTreeNode node = (RadTreeNode)container;
        label1.Text = "Property 2: ";
        label1.CssClass = "PropertyLabel";
        label2.Text = node.Text;
        label2.CssClass = "PropertyValue";
        label2.DataBinding += new EventHandler(label2_DataBinding);
        container.Controls.Add(label1);
        container.Controls.Add(label2);
    }
    public void label2_DataBinding(object sender, EventArgs e)
    {
        Label target = (Label)sender;
        RadTreeNode node = (RadTreeNode)target.BindingContainer;
        string nodeText = (string)DataBinder.Eval(node, "Text");
        target.Text = nodeText;
    }
}
Plamen
Telerik team
 answered on 01 Aug 2011
1 answer
101 views
Hi, i´m having a problem with RadTreeView.

When try to add a new node in the tree and cancel de operation by pressing ESC (escape) the operation is realy canceled but a "GHOST NODE" continues in the tree.

The same problem happens in RadTreeView live demo. http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx

When I reload the page, the ghost node disappears correctly

I want the node does not appear in the tree when an inclusion is canceled.

See the atached image.

Plamen
Telerik team
 answered on 01 Aug 2011
4 answers
111 views
Sorry, I'm lost, I think I've tried all options and read pdf and so on but I'm still not getting it right:
I've set my RadGrid to inline edit mode, Tablelayout = fixed. Now I have a GridDateTimeColumn. I've set the width to 100px using CSS. This works fine for both display and edit, but when I go to edit mode the DateItem does not fit to the column. It's larger and so the calendar pickup does not display. How do I set the size of the editable item so that it fits to its column?
Thanks
Kai
Top achievements
Rank 2
 answered on 01 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?