Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
49 views
Hi,

Does RadEditor work with .Net Framework 2.0 or it only works with 3.5 and 4.0?

Regards,
Tim
Neil
Top achievements
Rank 1
 answered on 14 Mar 2011
2 answers
133 views
I have a need to extend the radListBox control to add some custom paging and filtering to it to improve performance (I am potentially loading several thousand rows into the list).  I've tried creating a custom control based on the radListBox but have run into various issues.

Can someone point me to a good example of extending the radListBox control or a control that is similar to it?  I've looked with not much luck.
Trent Ballew
Top achievements
Rank 1
 answered on 14 Mar 2011
3 answers
108 views
Hi,

I am creating a Grid in code behind which has all cells set to edit option and the save is on the save command.

My Grid is coded as such

<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" OnDataBinding="RadGrid1_DataBinding"
    OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand"
    Skin="Web20" runat="server" GridLines="None" OnItemCreated="RadGrid1_ItemCreated"
    style="top: 190px; left: 10px; position: absolute;" width="750px" Height="280px" >
    <MasterTableView EditMode="InPlace" CommandItemDisplay="Top" DataKeyNames="ID" AutoGenerateColumns="true" ShowFooter="True">
        <CommandItemTemplate>
        <div style="padding: 5px 5px;">
            <asp:LinkButton ID="btnAddNew" runat="server" CommandName="AddNewRow">
                <img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />
                Add New Row
                </asp:LinkButton>  
            <asp:LinkButton ID="btnSave" runat="server" CommandName="Save">
                <img style="border:0px;vertical-align:middle;" alt="" src="Images/save.png" />
                Save in Database
                </asp:LinkButton>  
        </div>
        </CommandItemTemplate>
    </MasterTableView>
    <ClientSettings>
        <Scrolling AllowScroll="true" ScrollHeight="230" UseStaticHeaders="true" />
    </ClientSettings>
</telerik:RadGrid>


And in the Code Behind

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
        saveDataInDataTable();
        switch (e.CommandName)
        {
            case "InsertNewRow":
                {
                    AddNewRowInDataTable();
                    //saveDataInDataTable();
                    string script = "setTimeout( function () { selectedCellId='" + e.CommandArgument.ToString() + "'; MoveDown();},100);";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "selectCell", script, true);
                    ViewState["inserted"] = true;
 
                }
                break;
            case "AddNewRow":
                {
                    AddNewRowInDataTable();
                    //saveDataInDataTable();
                }
                break;
            case "Save":
                {
                    //saveDataInDataTable();
                    //UpdateDatabase();
                    //Session["key"] = 0;
                    //RadAjaxManager1.Alert("The database was successfully updated");
                }
                break;
            default: break;
        }
    }
 
    // Add new empty row into DataTable
    private void AddNewRowInDataTable()
    {
        NewRowsCount++;
        DataRow row = GridSource.NewRow();
        row["ChequeID"] = txtChequeID.Text;       
        row["AccountNo"] = "";
        row["AccountName"] = "";
        row["Amount"] = 0;
        row["VAT"] = "S";
        row["VATAmount"] = 0;
        GridSource.Rows.Add(row);
        RadGrid1.Rebind();
    }
 
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            TextBox Amount = (e.Item as GridEditableItem)["Amount"].Controls[0] as TextBox;
            Amount.AutoPostBack = true;
            Amount.TextChanged += new System.EventHandler(this.Amount_TextChanged);
            string eventHandler = string.Format("gridTextBoxOnFocus('{0}');", Amount.ClientID);
            Amount.Attributes.Add("onFocus", eventHandler);
 
            TextBox AccountNo = (e.Item as GridEditableItem)["AccountNo"].Controls[0] as TextBox;
            AccountNo.AutoPostBack = true;
            AccountNo.TextChanged += new System.EventHandler(this.AccountNo_TextChanged);
        }
    }
 
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        RadGrid1.Attributes.Add("onkeydown", "onKeyDown(this,event);");
        int itemsCount = 0;
        int columnsCount = 0;
        StringBuilder builder = new StringBuilder();
        // Attach the event handlers to the client side events of the TextBoxes.
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
        {
            if (item is GridDataItem)
            {
                columnsCount = 0;
                for (int i = 2; i < RadGrid1.MasterTableView.RenderColumns.Length; i++)
                {
                    GridColumn column = RadGrid1.MasterTableView.RenderColumns[i];
                    TextBox textBox = (item[column.UniqueName].Controls[0]) as TextBox;
                    if (textBox != null)
                    {
                        textBox.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + textBox.ClientID + "');");
                        textBox.Attributes.Add("onclick", "cellClick('" + textBox.ClientID + "');");
                    }
                    if ((i == 2) || (i == 3) || (i == 4))
                    {
                        textBox.ReadOnly = true;
                        textBox.Attributes.Add("class", "readOnly");
                    }
                    columnsCount++;
                }
                itemsCount++;
            }
        }
 
        if (RadGrid1.MasterTableView.Items.Count > 0)
        {
            RadGrid1.MasterTableView.GetColumn("ID").Visible = false;
            RadGrid1.MasterTableView.GetColumn("ChequeID").Visible = false;
            RadGrid1.MasterTableView.GetColumn("CustomerID").Visible = false;
        }
       RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "init", "colls = " + columnsCount + ";rows=" + itemsCount + ";", true);
    }

What I want to do is have on of the columns in the grid be a radcombobox rather than a simple textbox.

I already have a combo box on the page outside the grid and would like the same combobox (it can be a duplicate of the original one) in each grid row.

The reason I am creating the grid as such is because the user wants all the grid rows to be in edit mode so they dont have to click edit and save for each row, rather they change all the rows or add new ones and click save once.

My radcombox box already on the page is:

<telerik:RadComboBox ID="drpParentAccount" runat="server" Height="200px" Width="240px"
                                    Filter="Contains" EmptyMessage="Choose Parent Account" MarkFirstMatch="true" ChangeTextOnKeyBoardNavigation="false"
                                    DataTextField="Account" DataValueField="Account" OnItemDataBound="RadComboBoxParentAccount_ItemDataBound"
                                    EnableLoadOnDemand="true" OnItemsRequested="RadComboBoxProduct_ItemsRequested"
                                    AutoPostBack="true" DataSourceID="SqlDataSourceParentAccount"
                                    style="top: 10px; left: 550px; position: absolute;">
 
                                    <HeaderTemplate>
                                        <table style="width: 240px" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td style="width: 60px;">
                                                    Number</td>
                                                <td style="width: 180px;">
                                                    Namer</td>
                                            </tr>
                                        </table>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <table style="width: 240px" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td style="width: 60px;">
                                                    <%# DataBinder.Eval(Container.DataItem, "Account") %>
                                                </td>
                                                <td style="width: 180px;">
                                                    <%# DataBinder.Eval(Container.DataItem, "AccountName") %>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                     
                                </telerik:RadComboBox>

I already have columns selected for Account and AccountName as textboxes in the Grid. But I want the Account column to be a dropdown similar to above.

Any help on how to get that going using PreRender.

Thanks,

Ads
Vasil
Telerik team
 answered on 14 Mar 2011
5 answers
373 views
Hi,

How to save image into database on button click using RadAysncUpload control.

Please Help!

Regards
Ravi
Dimitar Terziev
Telerik team
 answered on 14 Mar 2011
5 answers
78 views
Hi, I am using various telerik components which are working fine. If the server goes down and someone still has the web application open and they click on something that will cause a callback, you will get the following error

Data not loaded: Object doesn't support this property or method

this is easy to trap in Firefox (using window.onerror) but it does not work in IE, whats the best way of dealing with this as "Data not loaded: Object doesn't support this property or method" does not mean anything to an end user.

thanks
Maria Ilieva
Telerik team
 answered on 14 Mar 2011
2 answers
78 views
Hi,

I have a heirarchy grid. But I am having a problem with it.

The detail row is showing all the records from the table rather than just the ones which match the parent row.

My Grid Code is:

    <telerik:RadGrid ID="RadGrid1" DataSourceID="SessionDataSource1" runat="server" ShowStatusBar="false"
    AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
    AllowPaging="False" GridLines="None" ShowFooter="False" Skin="Web20"
    style="top: 5px; left: 5px; position: absolute;" Width="780px" Height="470px">
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <MasterTableView DataSourceID="SessionDataSource1" DataKeyNames="TOPID" AllowMultiColumnSorting="True"
        Width="100%" CommandItemDisplay="None" Name="Customers" HierarchyDefaultExpanded="true">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="BOTID" DataSourceID="SessionDataSource2" Width="100%"
                runat="server" CommandItemDisplay="None" Name="Orders">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="BOTID" MasterKeyField="TOPID" />
                </ParentTableRelation>                      
                <Columns>
                    <telerik:GridBoundColumn SortExpression="BOTID" HeaderText="JournalID" HeaderButtonType="TextButton"
                        DataField="BOTID" UniqueName="BOTID" Visible="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Account" HeaderText="Account" HeaderButtonType="TextButton"
                        DataField="Account" UniqueName="Account">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="AccountName" HeaderText="Account Name" HeaderButtonType="TextButton"
                        DataField="AccountName" UniqueName="AccountName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Debit" HeaderText="Debit" HeaderButtonType="TextButton"
                        DataField="Debit" UniqueName="Debit">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Credit" HeaderText="Credit" HeaderButtonType="TextButton"
                        DataField="Credit" UniqueName="Credit">
                    </telerik:GridBoundColumn>                          
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="Account"></telerik:GridSortExpression>
                </SortExpressions>                       
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
             
            <telerik:GridBoundColumn SortExpression="Date" HeaderText="Date" HeaderButtonType="TextButton"
                DataField="Date" UniqueName="Date">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="TOPID" HeaderText="JournalID" HeaderButtonType="TextButton"
                DataField="TOPID" UniqueName="TOPID" Visible="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="JournalTitle" HeaderText="Title" HeaderButtonType="TextButton"
                DataField="JournalTitle" UniqueName="JournalTitle">
            </telerik:GridBoundColumn>           
        </Columns>
        <SortExpressions>
            <telerik:GridSortExpression FieldName="Date"></telerik:GridSortExpression>
        </SortExpressions>
    </MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SessionDataSource1" ConnectionString="<%$ ConnectionStrings:SASConnectionString %>"
    ProviderName="System.Data.SqlClient" runat="server"
    SelectCommand="Select DISTINCT JournalID AS TOPID, Convert(char(10),CreationDate,103) AS [Date], JournalTitle from Journal
                        Where (JournalID Like @drpJournal) AND (Journal.CreationDate >= @DateFrom) AND (Journal.CreationDate <= @DateTo)"
    >
    <SelectParameters>
        <asp:ControlParameter ControlID="drpJournal" Name="drpJournal" PropertyName="SelectedValue" Type="String" />
        <asp:ControlParameter ControlID="RadDatePicker1" Name="DateFrom" PropertyName="SelectedDate" Type="DateTime" />
        <asp:ControlParameter ControlID="RadDatePicker2" Name="DateTo" PropertyName="SelectedDate" Type="DateTime" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SessionDataSource2" ConnectionString="<%$ ConnectionStrings:SASConnectionString %>"
    ProviderName="System.Data.SqlClient" runat="server"
    SelectCommand="Select JournalID AS BOTID, Journal.Account, AccountName, SUM(Debit) AS Debit, SUM(Credit) AS Credit from Journal JOIN Ledger ON Journal.Account = Ledger.Account
                        Where (JournalID Like @drpJournal) AND (Journal.CreationDate >= @DateFrom) AND (Journal.CreationDate <= @DateTo) GROUP BY JournalID, Journal.Account, AccountName"
     >
     <SelectParameters>
        <asp:ControlParameter ControlID="drpJournal" Name="drpJournal" PropertyName="SelectedValue" Type="String" />
        <asp:ControlParameter ControlID="RadDatePicker1" Name="DateFrom" PropertyName="SelectedDate" Type="DateTime" />
        <asp:ControlParameter ControlID="RadDatePicker2" Name="DateTo" PropertyName="SelectedDate" Type="DateTime" />
    </SelectParameters>
</asp:SqlDataSource>

The grid brings the 3 Parent record where the JournalID = 96, 99 and 100. But then under each of them it shows the records with all 3 JournalIDs, while it should only show the records with JournalID 96 under Parent 96 etc.

Any ideas how to resolve this.

Ads
Adeel
Top achievements
Rank 1
 answered on 14 Mar 2011
3 answers
163 views
I have been working with the grid control (specifically client side binding) and it is really nice once you get Linq figured out.

However, I am wondering if there is a way to append rows to the grid client side via a web service. I suspect there isn't because you need to set the data source to the result set and then rebind if you need a new page of data. This effectively removes all the rows that had been previously sent to the browser. I have a dataset that is about 1000 rows with 17 columns and needed to bump up the maxJasonLength just to get the data. Then there is the performance hit on rendering on the client. So I am sticking with paging but the client isn't too happy.

Maybe there is a hack that someone has figure out. Possibly storing the original JSON object and appending to that? I'm open to ideas.

If not then this would be a nice feature for just a flat grid.

Just thought I's ask.
Thanks,

Craig
Veli
Telerik team
 answered on 14 Mar 2011
1 answer
106 views
Hi,

I have a radtreeview with load on-demand functionality and works fine.
What I would like to do is to hide checkbox for nodes which have child nodes count > 0. For root data it works, but not for child nodes.

Here is my code:

private static void LoadRootNodes(RadTreeView treeView, TreeNodeExpandMode expandMode)
    {
    .
    .
    .
        foreach (var row in sdps)
        {
            RadTreeNode node = new RadTreeNode
                                   {
                                       Text = row.FullText,
                                       Value = row.id.ToString(),
                                       ExpandMode = expandMode
                                   };
            node.Attributes.Add("IdAsText", row.IdAsText);
            if (row.ChildrenCount== 0)
            {
                node.ExpandMode = TreeNodeExpandMode.ClientSide;
            }
            else
            {
        //This works because RadTreeNode has a Checkable propery
                node.Checkable = false;
            }
            treeView.Nodes.Add(node);
        }
    }
 
 
   [WebMethod]
    public static RadTreeNodeData[] LoadSdpTreeView(RadTreeNodeData node)
    {
    .
    .
    .
        List<RadTreeNodeData> result = new List<RadTreeNodeData>();
        foreach (var row in childNodes)
        {
            RadTreeNodeData childNode = new RadTreeNodeData { Text = row.FullText, Value = row.id.ToString() };
            childNode.Attributes.Add("IdAsText", row.IdAsText);
            if (row.ChildrenCount > 0)
            {
                childNode.ExpandMode = TreeNodeExpandMode.WebService;
        // This doesnt work because there is no Checkable propery for RadTreeNodeData
        // childNode.Checkable = false;
            }
 
            result.Add(childNode);
        }
 
        return result.ToArray();
    }

How can I achieve this?

Thanks in advance.
Nikolay Tsenkov
Telerik team
 answered on 14 Mar 2011
1 answer
126 views
Hi,

I was wondering if it's possible to change the language of the RadDateTimePicker in the GridDateTimeColumn.

I've managed to get a date in the correct format by setting this in the PageLoad:
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("nl-nl");
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("nl-nl");

But all the other text is still in english.

Does anyone know a way to change that?

Sincerely
Mira
Telerik team
 answered on 14 Mar 2011
1 answer
50 views
I have a big problem that so far I have not seen an answer for. I have a web app using the RAD DateTime Picker and the RADGrid, they work fine on my local machine and on our test server but when I deploy it to the live server I get this error:

"

Unable to cast object of type 'System.Web.Configuration.ScriptingProfileServiceSection' to type 'System.Web.Configuration.ScriptingProfileServiceSection'.

".

I have researched this error and found no solution to it yet. I know that some of the sites on this server are using an older version of Telerik controls so I don't know if this is an issue or not, but our test server is doing the same thing and it runs on there. HEre is my web.config file.

<?xml version="1.0"?>
<configuration>
  <appSettings />
  <connectionStrings />
  <system.web>
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Windows" />
    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.
 
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
    </handlers>
  </system.webServer>
</configuration>

I need a solution on this asap otherwise I cannot continue using your controls.

Thanks!
Mira
Telerik team
 answered on 14 Mar 2011
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?