Is this possible to do ?

6 posts, 0 answers
  1. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 07 Jan 2012 Link to this post

    I'm trying to achieve a different visual style within the combo box...

    Notice the word "Yes" and the rest of the wording in a paler color .

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Jan 2012 Link to this post

    Hello,

    Try the following code snippet.
    CS:
    protected void Page_Load(object sender, EventArgs e)
     {
         RadComboBox1.DataSource = CreateDataSource();
         RadComboBox1.DataTextField = "Name";
         RadComboBox1.DataValueField = "ID";
         RadComboBox1.DataBind();
     }
     protected DataTable CreateDataSource()
     {
         DataTable dataTable = new DataTable();
         dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
         dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
         DataRow dr = dataTable.NewRow();
         dr["ID"] = "1";
         dr["Name"] = "<b>FirstName1</b><font color=Red>This is some text!</font>"; //First part in bold and second in red.
         dataTable.Rows.Add(dr);
         DataRow dr2 = dataTable.NewRow();
         dr2["ID"] = "2";
         dr2["Name"] = "<b>FirstName2</b>LastName2";
         dataTable.Rows.Add(dr2);
         return dataTable;
     }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 14 Jan 2012 Link to this post

    Sounds great but it generated the html tags inside the value of a text input control...I'm gonna try to use a RadCombo with a Template...
    This should be possible...
  5. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 16 Jan 2012 Link to this post

    I used a Template Item for the RadCombo... and onItemDataBound, assigned the styles ... this works on the item template, but the selected item cannot be styled since it is in the input field. So I didnt quite achieve the desired output: Ie having Different Style in the Rad Combo ,,,

    I can probably  create my own custom combo using labels/div but is there a way of doing this  with the RadCombo?
  6. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 16 Jan 2012 Link to this post

    Hello Gotcha,

    I don't think this would be possible since the text value of the RadComboBox is displayed using an input element, which you can't place html inside, as it will show as is.
  7. Gotcha
    Gotcha avatar
    64 posts
    Member since:
    Sep 2009

    Posted 17 Jan 2012 Link to this post

    Thanks Princy ... are you from telerik team...just curious
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017