Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
130 views

Requirements

RadControls version

Q2 2009 (826)

.NET version

3.5

Visual Studio version

2008

programming language

C#

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
I have created a web project which has similar functionality to the ASP.NET Dynamic Data Web Application. This project only contains:
  • 1 webpage
    - 1 RadGrid to show (and modify) the data from the SQL table
    - 1 RadComboBox to show all LINQ to SQL tables from the Diagram
    - 3 Radiobuttons to set the EditMode property of the RadGrid
    - 1 Linkbutton to export the RadGrid to MS Excel
  • 1 LINQ to SQL diagram (which contains all tables from my AdventureWorks SQL Server database)

So this project is a lot simpler than the Dynamic Data Web Application... all thanks to Telerik ;-)

To use it within your own project, copy the webpage and LINQ to SQL diagram to your web project. Then delete all tables from the LINQ to SQL diagram and add all tables from the SQL Server database you wish to view and modify. That is all !!!

(I have removed the Telerik assembly from the attached ZIP)

Iana Tsolova
Telerik team
 answered on 11 Mar 2010
3 answers
326 views
 I want to give space between two toolbar button.
 
 It is possible for me in Radcontrol Asp.net Q3 2007 without applying any skin.

 In Radcontrol Asp.net ajax Q1 2008 it showing the toolbar button with no space bettween them.
How can i give the space between two toolbar button without applying skin.

Yana
Telerik team
 answered on 11 Mar 2010
1 answer
144 views


                            <telerik:RadComboBox ID="radCombo5"   
                                                 runat="server"   
                                                 Width="250px"   
                                                 Height="150px" 
                                                 DropDownWidth="298px" 
                                                 EnableLoadOnDemand="true"   
                                                 EnableVirtualScrolling="true" 
                                                 MarkFirstMatch="false" 
                                                 HighlightTemplatedItems="true" 
                                                 EmptyMessage="Digitare il comune da ricercare" 
                                                 OnClientItemsRequesting="radCombo5_OnClientItemsRequesting" > 
                                <WebServiceSettings Method="GetCity5" Path="_Selection.aspx" /> 
                         </telerik:RadComboBox> 

 
        [WebMethod]  
        public static RadComboBoxData GetCity5(RadComboBoxContext context)  
        {  
            RadComboBoxData comboData = new RadComboBoxData();  
            List<RadComboBoxItemData> result = new List<RadComboBoxItemData>();  
            if (context.Text != "")  
            {  
                try 
                {  
                    ComuneCollection comuneCollection = new ComuneCollection();  
 
                    string[] values;  
                    values = context.Text.Trim().Split(' ');  
                    Where w;  
                    foreach (string item in values)  
                    {  
                        if (item != null && item.Trim() != string.Empty)  
                        {  
                            w = new Where();  
                            w.Comparison = Comparison.Like;  
                            w.ColumnName = Comune.Columns.Descrizione;  
                            w.ParameterValue = "%" + item + "%";  
                            if ((bool)context["checked"])  
                                w.Condition = Where.WhereCondition.OR;  
                            else 
                                w.Condition = Where.WhereCondition.AND;  
                            comuneCollection.Where(w);  
                        }  
                    }  
 
                    comuneCollection.Load();  
 
                    if (comuneCollection.Count <= 1000)  
                    {  
 
                        foreach (Comune comune in comuneCollection)  
                        {  
                            RadComboBoxItemData itemData = new RadComboBoxItemData();  
                            itemData.Text = comune.Descrizione;  
                            itemData.Value = comune.Codprovincia + comune.Codcomune;  
 
                            if (comune.Codcatastale.Trim() == string.Empty)  
                                comune.Codcatastale = "ZZZ";  
 
                            itemData.Attributes.Add("Codcatastale", comune.Codcatastale);  
                            result.Add(itemData);  
                        }  
 
                        comboData.Message = String.Format("Trovati <b>{0}</b> elementi per <b>'{1}'</b>",  
                                                            comuneCollection.Count.ToString(),  
                                                            context.Text);  
                    }  
                    else 
                    {  
                        comboData.Message = String.Format("Trovati più di <b>1000</b> elementi. Affinare la ricerca");  
                    }  
 
                }  
                catch (Exception ex)  
                {  
                    comboData.Message = String.Format("<b>{0}</b>", ex.Message);  
 
                }  
            }  
            comboData.Items = result.ToArray();  
            return comboData;  
 
        }  
 

This code is OK!!!

But if I insert ItemTemplate I have a problem.

                            <telerik:RadComboBox ID="radCombo5"   
                                                 runat="server"   
                                                 Width="250px"   
                                                 Height="150px" 
                                                 DropDownWidth="298px" 
                                                 EnableLoadOnDemand="true"   
                                                 EnableVirtualScrolling="true" 
                                                 MarkFirstMatch="false" 
                                                 HighlightTemplatedItems="true" 
                                                 EmptyMessage="Digitare il comune da ricercare" 
                                                 OnClientItemsRequesting="radCombo5_OnClientItemsRequesting" > 
                                <WebServiceSettings Method="GetCity5" Path="_Selection.aspx" /> 
                                <HeaderTemplate> 
                                    <table style="width: 275px" cellspacing="0" cellpadding="0">  
                                        <tr> 
                                            <td style="width: 177px;">  
                                                Comune</td> 
                                            <td style="width: 60px;">  
                                                CodIstat</td> 
                                            <td style="width: 40px;">  
                                                CodCatasto</td> 
                                        </tr> 
                                    </table> 
                                </HeaderTemplate> 
                                <ItemTemplate> 
                                    <table style="width: 275px" cellspacing="0" cellpadding="0">  
                                        <tr> 
                                            <td style="width: 177px;">  
                                                <%# DataBinder.Eval(Container, "Text")%> 
                                            </td> 
                                            <td style="width: 60px;">  
                                                <%# DataBinder.Eval(Container, "Value")%> 
                                            </td> 
                                            <td style="width: 40px;">  
                                                <%# DataBinder.Eval(Container, "Attributes['Codcatastale']")%> 
                                            </td> 
                                        </tr> 
                                    </table> 
                                </ItemTemplate> 
                                  
 
                                  
                            </telerik:RadComboBox> 

The HeaderTemplate is ok.
But the ItemTemplate isn't apply, the Items are displayed in defualt mode.

Is It possibile apply Template on Item On ajax binding?
Thanx



Simon
Telerik team
 answered on 11 Mar 2010
1 answer
210 views
Hi

I'm populating my radgrid using ADO.NET. I send the parameters to a method. The method then returns a dataset, which is placed into a local dataset.

The method's input parameter type for the radDatePicker is DateTime. I have tried everything I can think of to make the error disappear.

I have tried placing the control's SelectedValue and dbSelectedValue into a Convert.ToDateTime, I have tried parsing the value to a string and then have the method input parameter type also as a string, but the error keeps showing up.

Please advice.

Thank you
Veli
Telerik team
 answered on 11 Mar 2010
4 answers
151 views
Hi.

I have just started to use telerik:RadEditor, and I have a few problems.

1) How do I get rid of the toolbar? I have two radeditor on the same page. One of them is for reading text entred on an other page, and the other is for editing text on this page. I don't want any toolbar on the editor that is only for reading text, but I want toobar on the editor that is for editing text on the page.

2) How do I get the editor to start with a predefined font and fontsize. I have a small BasicTool.xml file like this:

ToolsFile="~/BasicTools.xml"

 

 

When used I can select from different fonts.
But I would like to set a Font (Verdana) as standard and size 13px as standard size. How do I do that?

 

 

Erling Ervik
Top achievements
Rank 1
 answered on 11 Mar 2010
5 answers
301 views
Hello everyone

I am trying to create dynamic RadComboBox in my Ajax request, and then sending back as html, for this i am using RenderControl for the  RadComboBox control. but I get this error when it executes the RenderControl method ...

new ajax_error('System.InvalidOperationException','Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.',0)

Here is the code snippet 

	
Dim sb As New StringBuilder 
        Dim sw As New System.IO.StringWriter(sb) 
        Dim hw As New HtmlTextWriter(sw) 
 
        Dim ddlCountries As New Telerik.Web.UI.RadComboBox 
        ddlCountries.ID = "ddlCountries" 
        Dim loc As New Frokht.Location 
        Dim dr As Data.SqlClient.SqlDataReader 
 
        dr = loc.GetAllCountries() 
        ddlCountries.DataSource = dr 
        ddlCountries.DataTextField = "Name" 
        ddlCountries.DataValueField = "Code" 
        ddlCountries.DataBind() 
ddlCountries.RenderControl(hw)


Please help

Thanks in advance


Simon
Telerik team
 answered on 11 Mar 2010
1 answer
113 views
Hi

I am using the sample at the link
http://www.telerik.com/community/forums/aspnet/combobox/combobox-with-multiselect-checkbox-which-load-on-demand.aspx
as a reference to load multi select radcombo with check boxes.

I am able to load the Multi select combo but my reqirement is in that multi select combo I want to show default/first element every time the combo binds with text SELECT, how can I achieve this?


thanks,


Simon
Telerik team
 answered on 11 Mar 2010
2 answers
147 views
Hello,

I use the following code to have a google like search of a MSSQL2008 database. MsSql 2008 now offers the Full text catalog indexed keywords in a queryable format. Using this list offers search suggestions like google. I retrieve the keywords, put them in App Cache and use it in the Itemsrequested event. I managed to mimic google by adding an itemtemplate to the radcombo, hiding the dropdown arrow, not expanding on ficus etc. But now I set the loading message to an empty string, but the loading bar will still be visible while typing. How can I hide this?

Here's my code. Based on the latest Q3 release. Net framework 3.5. I am posting all code because others might find it interesting. Not really neccesary for my question.


The webservice that queries the keyword index on MsSQL 2008 full text catalog (uses system stored procedure:

[WebMethod]  
        public DataSet GetCatalogKeywords(string searchTerm)  
        {  
            //Build the SqlCilent Objects we need   
            SqlConnection conn = new SqlConnection("server=192.168.0.52; database=MyDatabase; User Id=sa; Password=MyPassword");  
            SqlCommand cmd = new SqlCommand();  
            //SqlDataAdapter to populate our DataSet   
            SqlDataAdapter adapter = new SqlDataAdapter();  
            //DataSet to hold the users information   
            DataSet dsInfo = new DataSet();  
            //String to hold our stored procedure   
            const string query = "WebserviceKeySearch";  
            //try...catch block to handle any unhandeled exceptions   
            try  
            {  
                //set our SqlCommands Objects   
                cmd.CommandText = query;  
                cmd.CommandType = CommandType.StoredProcedure;  //tell it its a Stored Procedure we're executing   
                cmd.Parameters.AddWithValue("@searchTerm", searchTerm);  
 
                cmd.Connection = conn;  
   
                adapter.SelectCommand = cmd;  
                //fill our DataSet   
                //using the Fill Method of   
                //the SqlDataAdapter   
                adapter.Fill(dsInfo);  
                //return the DataSet to the calling aspx page   
                return dsInfo;  
            }  
            catch (Exception ex)  
            {  
                System.Web.HttpContext.Current.Response.Write(ex.Message);  
                return null;  
            }  
            finally  
            {  
                  
            }  
        } 


The stored procedure:


 

SELECT distinct display_term, sum(document_count) AS HitCount

 

FROM

 

sys.dm_fts_index_keywords

 

 

 

(DB_ID('Hezelbase'), OBJECT_ID('Regeling')) where display_term like @searchTerm + '%' group by display_term order by display_term

 

 

The aspx page with RadCombo as searchbox:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %> 
 
<!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>  
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" /> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        <Scripts> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
        </Scripts> 
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    </telerik:RadAjaxManager> 
      
    <telerik:RadScriptBlock ID="rsbc" runat="server">  
          
    </telerik:RadScriptBlock> 
    <div> 
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">  
            <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="330px" Height="150px" DropDownWidth="420px" 
                EmptyMessage="Zoeken..." EnableLoadOnDemand="True" ShowMoreResultsBox="false" HighlightTemplatedItems="true" ShowDropDownOnTextboxClick="false" 
                ShowToggleImage="false" ShowWhileLoading="false" AccessibilityMode="true" CloseDropDownOnBlur="true" LoadingMessage=""   
                OpenDropDownOnLoad="false" EnableVirtualScrolling="false" OnItemsRequested="RadComboBox1_ItemsRequested">  
                <ItemTemplate> 
                    <table style="width: 325px" cellspacing="0" cellpadding="0">  
                        <tr> 
                            <td style="width: 200px;">  
                                <%# DataBinder.Eval(Container, "Text")%> 
                            </td> 
                            <td style="width: 100px; color:Green;">  
                                <%# DataBinder.Eval(Container, "Attributes['HitCount']")%> 
                            </td> 
                              
                        </tr> 
                    </table> 
                </ItemTemplate> 
            </telerik:RadComboBox> 
        </telerik:RadAjaxPanel> 
    </div> 
    </form> 
</body> 
</html> 
 

The code behind:

using System;  
using System.Data;  
using HezelbaseWebService;  
using Telerik.Web.UI;  
 
public partial class Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
 
    private void fillCahceFromService()  
    {  
        Service1 s = new Service1();  
        DataSet ds = s.GetCatalogKeywords("%");  
 
        Cache["Webservicedata"] = ds;  
 
    }  
 
    protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)  
    {  
        RadComboBox combo = (RadComboBox)o;  
 
        if(Cache["Webservicedata"] == null || Cache["Webservicedata"].GetType() != typeof(DataSet))  
        {  
            fillCahceFromService();  
        }  
 
        if (e.Text.Length > 1)  
        {  
            DataSet ds = (DataSet)Cache["Webservicedata"];  
 
            if (ds != null && ds.Tables.Count > 0)  
            {  
                DataRow[] dataRows = ds.Tables[0].Select("display_term like '" + e.Text + "%'");  
 
                foreach (DataRow dataRow in dataRows)  
                {  
                    RadComboBoxItem item = new RadComboBoxItem();  
                    string HitCount = dataRow["HitCount"].ToString();  
 
                    item.Text = (string)dataRow["display_term"];  
                    item.Attributes.Add("HitCount", HitCount + " results");  
                    combo.Items.Add(item);  
                    item.DataBind();  
                }  
            }  
        }  
 
    }  
}  
 
Yeroon
Top achievements
Rank 2
 answered on 11 Mar 2010
2 answers
113 views
Hello,

I have stackedbar chart bound to a sqldatasource control which calls a stored procedure.  The dataset returned contains 3 colums: Date Range, Messages Sent, and Messages Received.  The Messages Sent and Messages Received fields correctly show on the y-axis in the stackedbars, however, I want to be able to change the labels on the X-Axis from the generic 1, 2, 3... to the corresponding Date Range field.

How can I go about this?

Thanks,
Ron
Ves
Telerik team
 answered on 11 Mar 2010
2 answers
76 views
Hi,
with the new Q1 2010 version, the pager is not shown when item count is lower than the pagesize.

PageSize

 

="100" AllowPaging="true"

 

<

 

PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="Bottom" />

When i bind a datasource with more than 100 items, the pager is shown correctly.
When i downgrade to Q3 2009 it works correctly.

 

Design:  
<asp:ScriptManager ID="script1" runat="server" EnablePartialRendering="true"></asp:ScriptManager> 
<telerik:RadGrid ID="grid1" runat="server" AllowPaging="true" PagerStyle-AlwaysVisible="true" PageSize="5">  
      <MasterTableView AutoGenerateColumns="true"></MasterTableView> 
</telerik:RadGrid> 
 
Code:  
Dim list As New Generic.List(Of String)  
For i As Integer = 0 To 1 ' Change this to 5 to see the pager...  
 list.Add(i.ToString)  
Next  
grid1.DataSource = list 
grid1.DataBind() 

Falk

Falk Wegener
Top achievements
Rank 1
 answered on 11 Mar 2010
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?