Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
136 views
Hello,

I am having a problem where webresources seems to override CSS classes that I set in code. What's strange is that the styling is working for an alternating item, but not a regular one. When I'm debugging I can see that the class is being set through code, and on the web page itself the item's CSS class reflects this change, but for a non-alternating item it doesn't work. What I am setting in CSS is the borders to none and a background color determined in code.

There is no explanation that I can find as to why this is happening; it seems rather random. I was developing and everything was working fine, and all of a sudden this started to happen without any changes to my controls library.

This also occurred a few weeks ago with a nested table header. CSS was set for the header, but webresources brute forced a background image into the CSS. I was able to fix this problem through code and style, but am unable to for the problem I'm posting about.

On a final note, the !Important style declaration doesn't have any impact.

Thanks for any help!
Ryan

Controls v2011.2.712.35

C# code:
if (item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem)
 {
    if (item.BackColor == Color.FromArgb(Int32.Parse("C7EAC7", System.Globalization.NumberStyles.HexNumber)))//GREEN
   {
    item.ChildItem.NestedTableViews[0].CssClass = "altDrawInfo build";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "C7EAC7";
    }
    else if (item.BackColor == Color.FromArgb(Int32.Parse("FCB9B8", System.Globalization.NumberStyles.HexNumber)))//RED
    {
    item.ChildItem.NestedTableViews[0].CssClass = "altDrawInfo asBuilt";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "FCB9B8";
    }
    else if (item.BackColor == Color.FromArgb(Int32.Parse("FFFFCC", System.Globalization.NumberStyles.HexNumber)))//ORANGE
    {
    item.ChildItem.NestedTableViews[0].CssClass = "altDrawInfo approval";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "FFFFCC";
    }
    else//DEFAULT
    {
    item.ChildItem.NestedTableViews[0].CssClass = "altDrawInfo";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "EEEEEE";
    }
}
else
{
    if (item.BackColor == Color.FromArgb(Int32.Parse("C7EAC7", System.Globalization.NumberStyles.HexNumber)))//GREEN
    {
    item.ChildItem.NestedTableViews[0].CssClass = "DrawInfo build";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "C7EAC7";
    }
    else if (item.BackColor == Color.FromArgb(Int32.Parse("FCB9B8", System.Globalization.NumberStyles.HexNumber)))//RED
    {
    item.ChildItem.NestedTableViews[0].CssClass = "DrawInfo asBuilt";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "FCB9B8";
    }
    else if (item.BackColor == Color.FromArgb(Int32.Parse("FFFFCC", System.Globalization.NumberStyles.HexNumber)))//ORANGE
     {
    item.ChildItem.NestedTableViews[0].CssClass = "DrawInfo approval";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "FFFFCC";
    }
    else//DEFAULT
    {
    item.ChildItem.NestedTableViews[0].CssClass = "DrawInfo";
    item.ChildItem.NestedTableViews[0].Style["background-color"] = "D8D8D8";
    }
}

Style code:
/* NON-ALTERNATING ROW */
 
.drawInfo /*  */
{
    background-color:#D8D8D8 !important;
    border-style:solid !important;
    border-color:#000000 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.drawInfo td /*  */
{
    background-color:#D8D8D8;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.build /* GREEN */
{
    background-color:#C7EAC7 !important;
    border-style:solid !important;
    border-color:#000000 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.build td /* GREEN */
{
    background-color:#C7EAC7 !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.asBuilt /* RED */
{
    background-color:#FCB9B8 !important;
    border-style:solid !important;
    border-color:#000000 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.asBuilt td /* RED */
{
    background-color:#FCB9B8 !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.approval /* ORANGE */
{
    background-color:#FFFFCC !important;
    border-style:solid !important;
    border-color:#000000 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.drawInfo.approval td /* ORANGE */
{
    background-color:#FFFFCC !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
/* ALTERNATING ROW */
 
.altDrawInfo /*  */
{
    background-color:#EEEEEE !important;
    border-style:solid !important;
    border-color:#F7F7F7 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo td /*  */
{
    background-color:#EEEEEE !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.build /* GREEN */
{
    background-color:#C7EAC7 !important;
    border-style:solid !important;
    border-color:#F7F7F7 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.build td /* GREEN */
{
    background-color:#C7EAC7 !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.asBuilt /* RED */
{
    background-color:#FCB9B8 !important;
    border-style:solid !important;
    border-color:#F7F7F7 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.asBuilt td /* RED */
{
    background-color:#FCB9B8 !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.approval /* ORANGE */
{
    background-color:#FFFFCC !important;
    border-style:solid !important;
    border-color:#F7F7F7 !important;
    border-width:0 2px 0 0 !important; /*top right bottom left*/
}
 
.altDrawInfo.approval td /* ORANGE */
{
    background-color:#FFFFCC !important;
    border-style:solid !important;
    border-color:#EDDA74 !important;
    border-width:0 0 0 0 !important; /*top right bottom left*/
}



Ryan
Top achievements
Rank 1
 answered on 11 Dec 2011
0 answers
77 views
One of the primary things I struggle with using Telerik controls is manipulating them via client-side code.  When I find a good solution I like to document it.  Here's an example of this, which I hope will help others: http://mwtech.blogspot.com/2011/12/retrieving-nested-aspnet-object-with.html
Robert
Top achievements
Rank 1
 asked on 10 Dec 2011
6 answers
333 views
Hi:
I was forcing an error (divide by zero).  My timestamp on that error is
Erik
Top achievements
Rank 2
 answered on 10 Dec 2011
2 answers
79 views
Currently, my grid displays Edit values vertically, like this:

Country Code: [Drop Down Control]
USD Denomination: [Text Control]
etc.

We feel it would be easier on the user if we just displayed text boxes horizontally as a single record with each edit value under the current value in the grid.

Additionally, we are going to have the user enter 4 related records all at once, which is another reason why a horizontal display makes more sense.
Elliott
Top achievements
Rank 2
 answered on 09 Dec 2011
7 answers
323 views
For some reason the dropdown is still coming up on my ComboBoxes even though they're not databound / have no items in them.

 
<telerik:RadComboBox ID="RadComboBox" DataSourceID="odsPopularProducts" Filter="Contains" 
          DataTextField="ProductName" DataValueField="ProductID" AllowCustomText="true" MaxHeight="300" 
          Width="205" OnSelectedIndexChanged="RadComboBoxProducts_SelectedIndexChanged" 
          AutoPostBack="true" DropDownWidth="300" OffsetX="-95" EmptyMessage="Select a Popular Product..." 
          runat="server">                                                                                                                 
</telerik:RadComboBox> 

How can I stop the dropdown from displaying when there are no items in it?
Kevin
Top achievements
Rank 2
 answered on 09 Dec 2011
3 answers
75 views
I am adding raddatepickers to the page dynamically and the sharecalendar part isn't working.

I have some sample code below. 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadDatePickerTest.aspx.cs" Inherits="NCCCN.CMIS.AdHOC.RadDatePickerTest" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"  />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
    <asp:PlaceHolder runat="server" ID="TemplatePH" />
    <asp:PlaceHolder runat="server" ID="PlaceHolder1" />
 
    <br /><br />
 
 
    <telerik:RadDatePicker runat="server" ID="ACal" />
    <telerik:RadDatePicker runat="server" ID="BCal" />
 
    </div>
    </form>
</body>
</html>



protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadCalendar cal = new RadCalendar();
cal.ClientIDMode = System.Web.UI.
ClientIDMode.Static;
cal.EnableMultiSelect =
false;
cal.ID =
this.ClientID + "SharedCalID";
TemplatePH.Controls.Add(cal);
RadDatePicker StartDatePicker = new RadDatePicker();
StartDatePicker.ClientIDMode = System.Web.UI.
ClientIDMode.Static;
StartDatePicker.AutoPostBack =
true;
//StartDatePicker.SelectedDateChanged += new SelectedDateChangedEventHandler(StartDatePicker_SelectedDateChanged);
StartDatePicker.SharedCalendar = cal;
StartDatePicker.SelectedDate =
new DateTime(2005, 1, 1);
StartDatePicker.ID =
this.ClientID + "SentFromFilterTemplate_StartDatePicker";
TemplatePH.Controls.Add(StartDatePicker);
 
RadDatePicker EndDatePicker = new RadDatePicker();
EndDatePicker.ClientIDMode = System.Web.UI.
ClientIDMode.Static;
EndDatePicker.AutoPostBack =
true;
// EndDatePicker.SelectedDateChanged += new SelectedDateChangedEventHandler(EndDatePicker_SelectedDateChanged);
EndDatePicker.SharedCalendar = cal;
EndDatePicker.SelectedDate =
new DateTime(2006, 1, 1);
EndDatePicker.ID =
this.ClientID + "SentFromFilterTemplate_EndDatePicker";
TemplatePH.Controls.Add(EndDatePicker);
ACal.SharedCalendar = cal;
BCal.SharedCalendar = cal;
}
}

 

 

 

 

Kevin
Top achievements
Rank 2
 answered on 09 Dec 2011
1 answer
166 views
Hi

I have what I thought was a very simple requirement, and maybe it is.

I have a ListBox that contains a few items, that I add programmatically in Server side code.

As each item is selected I want to dynammically load a use control and present it to the right of the ListBox.

Actually I have all of this working just fine.
Again I am using a server side selection changed event to control the dynamic loading. 

However I would like to set the intial selection to the first item in the listbox.
I have tried to do this after the LB is loaded, and I have set the first item to selected just before adding it to the LB.

In neither case do I get a selection change event so I can load the initial dynamic control.

What am I missing?

Do I just have to write extra code to load this control seperate from the SelectionChanged event I am relying on now?

TIA  
Bozhidar
Telerik team
 answered on 09 Dec 2011
12 answers
156 views

I'm not sure where this is going wrong, but any help would be appreciated.

I'm trying to add a column to an edit column to a grid (I also want to add a delete column, but I haven't gotten that far yet). I can make the column display without a problem, but the moment I click the button I get very odd results - the button disappears, my column headers move across and one of the bits of content from another of my columns vanishes entirely. I found it rather funny at first, but then I couldn't find out why it was doing it.

My code is below.

Private Sub rgdTable_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles rgdTable.DetailTableDataBind
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.Name
        Case "TUGDetailTable"
            Dim myTrackingGUID As Guid = New Guid(dataItem.Item("MerchantTrackingGUID").Text)
            Dim myDataSet As New DataSet
            '===Get the DetailTable data===
            myDataSet = *get data from database*
            myDataSet.Tables(0).Columns.Remove("Source")
            myDataSet.Tables(0).Columns.Remove("@Action")
            e.DetailTableView.DataSource = myDataSet
            e.DetailTableView.CommandItemDisplay = GridCommandItemDisplay.Top
            e.DetailTableView.CommandItemSettings.AddNewRecordImageUrl = "../Img/AddRecord.gif"
            e.DetailTableView.CommandItemSettings.AddNewRecordText = "Add New TUG Details"
            e.DetailTableView.CommandItemSettings.ShowRefreshButton = False
            e.DetailTableView.EditFormSettings.EditColumn.UniqueName = "EditCommandColumn1"
            e.DetailTableView.EditFormSettings.UserControlName = "../UserControls/Templates/TUGAdd.ascx"
            e.DetailTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl
            Dim editCol As GridEditCommandColumn
            editCol = New GridEditCommandColumn
            editCol.UniqueName = "EditColumn"
            editCol.HeaderText = ""
            editCol.HeaderStyle.Width = 20
            editCol.EditImageUrl = "~\img\edit.gif"
            editCol.ButtonType = GridButtonColumnType.ImageButton
            editCol.EditFormColumnIndex = 0
            e.DetailTableView.Columns.Add(editCol)
    End Select
End Sub

If anyone can tell me what's going wrong I'd appreciate it.
Pete
Top achievements
Rank 1
 answered on 09 Dec 2011
4 answers
87 views
I am wondering if the following scenario is supported:

  • After each file is uploaded to the temp folder, prompt the user to enter additional info about the file (I can see how to do this from the posted demo)
  • Persist the additional fields and file info until a specific button triggers a postback (I posted another thread asking how to use a PostbackTrigger when the triggering control is in a different user control)
  • In the OnFileUploaded server-side event handler, prevent the file from being auto-saved to TargetFolder, and instead save the uploaded file to a SharePoint document library along with the metadata provided in the "additional fields" on the client

To explain further, the reason I don't want the RadAsyncUpload control to use the default auto-save functionality using the TargetFolder is that the location the file will be saved to is determined based on some metadata about the file and some other business rules. In other words, I need to access data in the "additional fields" for each file in the server-side OnFileUploaded event handler and then determine the appropriate location to save the file (within a SharePoint document library).

Thanks, your help is greatly appreciated.

Kind regards,
Larkin
Kalina
Telerik team
 answered on 09 Dec 2011
1 answer
74 views
Hi

How can the I activate the disabled image while disabling the button on the client side using button.set_enabled(false)?

Cheers,
Jani
Slav
Telerik team
 answered on 09 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?