Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
110 views
We're using advanced data-binding with OnNeedDataSource.  When we retrieve new records to populate the grid, we do the following:
grd.datasource = null;
grd.rebind();

This fires the OnNeedDataSource event and returns a datatable.  What we've noticed is that if our initial retrieve takes 10 seconds to return the records and render the grid on the page, doing any paging or sorting will take the same amount of time when it also fires the OnNeedDataSource event.

What can we do to make the paging and sorting quicker if we already have the data?
robertw102
Top achievements
Rank 1
 answered on 03 May 2010
5 answers
159 views
Hello
I have used dropdown column in my rad grid. I am trying to bind it with a method (DataSourceID='<%# LoadPolicyType()). but I got the error "Telerik.Web.UI.GridDropDownColumn does not have a DataBinding event". Please suggest me how can I bind the dropdown with my sub-routine. 

aspx Code Sample:
<telerik:GridDropDownColumn DataField="PolicyType" DataSourceID='<%# LoadPolicyType() %>'
                        HeaderText="Policy Type" ListTextField="PolicyType" ListValueField="PolicyTypeID"
                        UniqueName="PolicyType" >
            </telerik:GridDropDownColumn>

Bricton Perez
Top achievements
Rank 1
 answered on 03 May 2010
1 answer
94 views
So I have read the article about copy and paste from the clipboard. I understand the problems, but Microsoft just released Silverlight 4 with much better functionality. How far away are we from pasting excel data into a grid?
Telerik, are you on this yet??
Jim
Top achievements
Rank 1
 answered on 03 May 2010
1 answer
112 views
I am using an XMLDataSource with RadGrid. When the grid loads it shows no data. I have an XML and an XSLT file and in Visual Studio when I choose the Show XSLT Output from the XML menu it shows correctly. Can someone take a look and see if I have something wrong or why Radgrid doesn't like the XML?
Here is my XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>  
<ns2:StorageVolume xmlns:ns2="http://www.nng.com/alertportal/processed/">  
  <companyNumber>179</companyNumber> 
  <gasDay>2009-12-18T00:00:00-06:00</gasDay> 
  <iddInjectionQuantity>739001</iddInjectionQuantity> 
  <nonPDDLPInjectionQuantity>185486</nonPDDLPInjectionQuantity> 
</ns2:StorageVolume> 
Here is my XSLT file:
<?xml version="1.0" encoding="UTF-8"?>  
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0" 
  xmlns:ns2="http://www.nng.com/alertportal/processed/" 
  xmlns:xalan="http://xml.apache.org/xslt">  
 <xsl:output method="xml" indent="yes"/>  
 
 <xsl:template match="ns2:StorageVolume">  
  <ns2:StorageVolume> 
   <xsl:attribute name="companyNumber">  
    <xsl:value-of select="companyNumber" /> 
   </xsl:attribute> 
   <xsl:attribute name="gasDay">  
    <xsl:call-template name="formatDate">  
     <xsl:with-param name="dateTime" select="gasDay" /> 
    </xsl:call-template> 
   </xsl:attribute> 
   <xsl:attribute name="iddInjectionQuantity">  
    <xsl:value-of select="iddInjectionQuantity" /> 
   </xsl:attribute> 
   <xsl:attribute name="nonPDDLPInjectionQuantity">  
    <xsl:value-of select="nonPDDLPInjectionQuantity" /> 
   </xsl:attribute> 
  </ns2:StorageVolume> 
 </xsl:template> 
 
 <xsl:template name="formatDate">  
  <xsl:param name="dateTime" /> 
  <xsl:variable name="date" select="substring-before($dateTime, 'T')" /> 
  <xsl:variable name="year" select="substring-before($date, '-')" /> 
  <xsl:variable name="month" select="substring-before(substring-after($date, '-'), '-')" /> 
  <xsl:variable name="day" select="substring-after(substring-after($date, '-'), '-')" /> 
  <xsl:value-of select="concat($month, '/', $day, '/', $year)" /> 
 </xsl:template> 
   
</xsl:stylesheet> 
Thank you for your help.
Chris LaFrancis
Top achievements
Rank 1
 answered on 03 May 2010
5 answers
217 views
Hi,
I am using an hierarchial radgridWhen a user expands a row in the mastertable, it causes the rebind of all the grid ! This happens even it isn't the first time the row is been expanded. This seems to be a big problem  because of the size of the DB and the SQL it needs to execute.
Is there a way, please, to stop the rebind of the master and detail tables after the first load of the grid ?

Regards,
Mounir
Mounir Maghraoui
Top achievements
Rank 1
 answered on 03 May 2010
10 answers
213 views
Hi,

i want disabled "ADD CUSTOM COLOR" in the colors icon in the Rad editor ?
i don't found in property :(

where i can disabled this function ?

thank's 
ch.

Ch Perez
Top achievements
Rank 1
 answered on 03 May 2010
1 answer
116 views
I am building a treeview with a grid like template (it may also become a listview rather than a grid).  When I load the non-templated nodes via .aspx it works fine, when I try do build the tree dynamically on server side it fails with the following error:

The DataSourceID of 'ctl00' must be the ID of a control of type IDataSource.  A control with ID 'Level 0' could not be found

I am not sure what I am doing wrong, any assistance would be appreciated.

I have attached a picture of what the correct display.

Working code:
<%@ Page Language="C#" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
    protected override void OnInit(EventArgs e) 
    { 
        RadTreeView1.NodeTemplate = new RadGridTemplate(); 
        base.OnInit(e); 
    } 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            foreach (RadTreeNode node1 in RadTreeView1.GetAllNodes()) 
            { 
                if (node1.Level == 1) 
                    node1.Nodes.Add(new RadTreeNode("SqlDataSource1")); 
            } 
        } 
        RadTreeView1.DataBind(); 
    } 
 
    class RadGridTemplate : ITemplate 
    { 
        public void InstantiateIn(Control container) 
        { 
            RadGrid RadGrid1 = new RadGrid(); 
            RadGrid1.DataBinding += new EventHandler(RadGrid_DataBinding); 
            container.Controls.Add(RadGrid1); 
        } 
        private void RadGrid_DataBinding(object sender, EventArgs e) 
        { 
            RadGrid target = (RadGrid)sender; 
            RadTreeNode node = (RadTreeNode)target.BindingContainer; 
            string source = (string)DataBinder.Eval(node, "Text"); 
            target.DataSourceID = source
        } 
    } 
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadTreeView ID="RadTreeView1" Runat="server"
        <Nodes>  
              <telerik:RadTreeNode Text="Level 0"
                <Nodes> 
                    <telerik:RadTreeNode Text="Level 1a" /> 
                    <telerik:RadTreeNode Text="Level 1b" /> 
                    <telerik:RadTreeNode Text="Level 1c" /> 
                    <telerik:RadTreeNode Text="Level 1d" /> 
                    <telerik:RadTreeNode Text="Level 1e" /> 
                    <telerik:RadTreeNode Text="Level 1f" /> 
                </Nodes> 
              </telerik:RadTreeNode>  
        </Nodes> 
        </telerik:RadTreeView>  
    </form> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:GolfLeague %>" 
        SelectCommand="select * from scores where memberid = 1" 
        SelectCommandType="Text"
    </asp:SqlDataSource> 
</body> 
</html> 
 

Not Working Code:
<%@ Page Language="C#" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
    protected override void OnInit(EventArgs e) 
    { 
        RadTreeView1.NodeTemplate = new RadGridTemplate(); 
        base.OnInit(e); 
    } 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            LoadTree(); 
            foreach (RadTreeNode node1 in RadTreeView1.GetAllNodes()) 
            { 
                if (node1.Level == 1) 
                    node1.Nodes.Add(new RadTreeNode("SqlDataSource1")); 
            } 
        } 
        RadTreeView1.DataBind(); 
    } 
 
    protected void LoadTree() 
    { 
        // 
        // ORIGINAL HIERACHICAL LOADING OF TREEVIEW 
        // 
        // get the hierachical data from the DAL 
        //DataTable dt = DAL.Routines.getFlightPlayerTree(); 
 
        //treeView.DataTextField = "Name"
        //treeView.DataFieldID = "ID"
        //treeView.DataValueField = "ID"
        //treeView.DataFieldParentID = "ParentID"
        //treeView.DataSource = dt
        RadTreeView1.Nodes.Clear(); 
        RadTreeNode node = new RadTreeNode("Level 0"); 
        node.Nodes.Add(new RadTreeNode("Level 1a")); 
        node.Nodes.Add(new RadTreeNode("Level 1b")); 
        node.Nodes.Add(new RadTreeNode("Level 1c")); 
        node.Nodes.Add(new RadTreeNode("Level 1d")); 
        node.Nodes.Add(new RadTreeNode("Level 1e")); 
        node.Nodes.Add(new RadTreeNode("Level 1f")); 
        RadTreeView1.Nodes.Add(node); 
    } 
 
    class RadGridTemplate : ITemplate 
    { 
        public void InstantiateIn(Control container) 
        { 
            RadGrid RadGrid1 = new RadGrid(); 
            RadGrid1.DataBinding += new EventHandler(RadGrid_DataBinding); 
            container.Controls.Add(RadGrid1); 
        } 
        private void RadGrid_DataBinding(object sender, EventArgs e) 
        { 
            RadGrid target = (RadGrid)sender; 
            RadTreeNode node = (RadTreeNode)target.BindingContainer; 
            string source = (string)DataBinder.Eval(node, "Text"); 
            target.DataSourceID = source
        } 
    } 
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadTreeView ID="RadTreeView1" Runat="server"
        </telerik:RadTreeView>  
    </form> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:GolfLeague %>" 
        SelectCommand="select * from scores where memberid = 1" 
        SelectCommandType="Text"
    </asp:SqlDataSource> 
</body> 
</html> 
 
Yana
Telerik team
 answered on 03 May 2010
5 answers
220 views
Is there a way to include the DataFormatString inside a group by expression? 

GroupByExpression

 

="StartTimeGB Arrived Group By StartTimeGB"

 

There are examples of how to declare one using markup, but all of them cause the grid to come up grouped by default, which I don't want. How can I do this without the default grouping?

Thanks,
Levi

Iana Tsolova
Telerik team
 answered on 03 May 2010
1 answer
121 views
I'm using the TimePicker, and was wondering if there is a way to simply type "n" for "now" (current datetime)?
Are there any shortcuts for the control?
I want the input empty until they enter a time. I do not want it to default to today or anything.
Thanks in advance for the suggestions.
~bg
Shinu
Top achievements
Rank 2
 answered on 03 May 2010
3 answers
132 views
Hi

In my rad grid I have used the code:-

<PagerTemplate>
            <asp:Panel ID="PagerPanel" Style="padding: 6px; line-height: 24px" runat="server">
                <div style="margin: 0px; float: left;">
                    <%# (int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") + 1%>
                    -
                    <%# (int)DataBinder.Eval(Container, "Paging.LastIndexInPage") + 1%>
                    (of
                    <%# DataBinder.Eval(Container, "Paging.DataSourceCount")%>
                    )
                </div>

                <div class="rgPagingCont">
                    <div class="rgPagingPanel">
                        <asp:Button ID="btnFirst" runat="server" OnClientClick="changePage('first'); return false;"
                            CommandName="Page" CommandArgument="First" Text="" CssClass="rgPageFirst" />
                        <asp:Button ID="btnPrev" runat="server" OnClientClick="changePage('prev'); return false;"
                            CommandName="Page" CommandArgument="Prev" Text="" CssClass="rgPagePrev" />
                        <div style="position: absolute; top: 0; left: 50px">
                            <asp:Panel runat="server" ID="NumericPagerPlaceHolderDepartment">
                            </asp:Panel>
                            <asp:Button ID="btnNext" runat="server" OnClientClick="changePage('next'); return false;"
                                CommandName="Page" CommandArgument="Next" Text="" CssClass="rgPageNext" />
                            <asp:Button ID="btnLast" runat="server" OnClientClick="changePage('last'); return false;"
                                CommandName="Page" CommandArgument="Last" Text="" CssClass="rgPageLast" />
                        </div>
                    </div>
                </div>
                <div style="float: right">
                    <span style="margin-right: 3px;">Results per page:</span>
                    <telerik:RadComboBox ID="rcPgSize" DataSource="<%# new object[]{25, 50, 75, 100} %>"
                        Width="65px" SelectedValue='<%# DataBinder.Eval(Container, "Paging.PageSize") %>'
                        runat="server" OnClientSelectedIndexChanged="rcPgSize_SelectedIndexChanged">
                    </telerik:RadComboBox>
                </div>
            </asp:Panel>
        </PagerTemplate>

Earlier , even if the result count was lesser then 1 page size , the code kept in bold used to show the no. of results like  1 - 25 (of 52 )

But after installing new rad wsp, if the result count is less than 1 page, the strip containing result count, pagination and results per page drop down is not rendered.
If the result count is more than 1 page size , only then this strip is rendered  now.

Is it a enhancement in latest rad/telrick  wsp, or its a bug which can be solved some way. I have not made any code change.


Please help.




Pavel
Telerik team
 answered on 03 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
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?