This is a migrated thread and some comments may be shown as answers.

Skinning causes some images to disapear

35 Answers 491 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kia
Top achievements
Rank 1
Kia asked on 12 Mar 2008, 03:48 AM
Hi,

I'm trying to create a custom skin for the Grid control. I've adapted a skin from one of the existing ones and changed the images, but there are some images that were not in that skin folder(eg, datePickerPopup.gif for any date fields).

So now my grid looks partially skinned with some missing images. Its looking for the default images in the project's root folder instead of the "ImagesPath" or where ever it used to. Also the popup calendar now looks horrible due to a change in skinning and lost its images.

Is it possible to have the grid use the default images and settings unless I change them? If not, can I set it up to look in the ImagesPath folder? If not, where can I find a full list of css elements that control all the grid? eg, How can I find which element controls the calendar popup image and so on?


Thanks,
Kia

35 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Mar 2008, 01:04 PM
Hi Kia,

Currently if you are using a custom non-embedded skin for RadGrid Prometheus, you can control the picker and Calendar images' URLs from the code-behind. Here is how to do it:

ASPX:

<telerik:RadGrid ID="RadGrid1" OnItemCreated="RadGrid1_ItemCreated"  />

C#:

        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
            {                
                GridDateTimeColumnEditor gridColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("HireDate"as GridDateTimeColumnEditor; 
                if (gridColumnEditor != null)  
                { 
                    RadDateTimePicker picker = gridColumnEditor.PickerControl as RadDateTimePicker; 
                    picker.DatePopupButton.ImageUrl = ".........."
                } 
            } 
        } 
 

As long as you have a reference to the picker, you can specify all Calendar images (next month, previous month, etc), for example:

picker.Calendar.NavigationNextImage = ".......";
picker.Calendar.NavigationPrevImage = ".......";
picker.Calendar.FastNavigationNextImage = ".......";
picker.Calendar.FastNavigationPrevImage = ".......";


When the Grid has EnableEmbeddedSkins set to "False", it does not look for embedded images in the assembly, but requires the ImagesPath property. Unfortunately, RadGrid child controls such as DateTimePickers currently do not obey this property and you have to set image URLs manually.

Let us know if you need more information.

Greetings,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kia
Top achievements
Rank 1
answered on 13 Mar 2008, 12:20 AM
Thanks Dimo,

So I'm guessing that I need to do this for every date field in the grid individually?

Apart from "Imports Telerik.WebControls" what else will I need to import? I seem to be missing something to recognise "GridEditableItem". Are you able to post the sample in VB?

Also an issue I have is that the site I'm creating is managed by people who will change their minds on layout and look 3 times a day. I'd much rather use a centralised CSS class. So this is not possible?

thanks,
Kia
0
Sebastian
Telerik team
answered on 13 Mar 2008, 09:16 AM
Hello Kia,

Yes, you will need to do that for every RadDateTimeColumn in the grid by accessing its column editor instance inside the ItemCreated handler. Additionally, with our Prometheus controls the namespace you need to add should be Telerik.Web.UI instead of Telerik.WebControls, namely:

Using Telerik.Web.UI

Here is the VB.NET version of the code converted with our free online converter:

Protected Sub RadGrid1_ItemCreated(ByVal sender As ObjectByVal e As GridItemEventArgs) Handles RadGrid1.ItemCreated  
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then 
        Dim gridColumnEditor As GridDateTimeColumnEditor = TryCast((DirectCast(e.Item, GridEditableItem)).EditManager.GetColumnEditor("HireDate"), GridDateTimeColumnEditor)  
        If Not gridColumnEditor Is Nothing Then 
            Dim picker As RadDateTimePicker = TryCast(gridColumnEditor.PickerControl, RadDateTimePicker)  
            picker.DatePopupButton.ImageUrl = ".........." 
        End If 
    End If 
End Sub 
 

Unfortunately you can not use centralized css class for the date picker pop-up/navigation images simply because they are not rendered as part of css but rather with img tags. Instead you can set those images in a centralized folder and simply replace them with new ones if necessary.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sl6rp
Top achievements
Rank 1
answered on 13 Mar 2008, 02:45 PM
How would I do this if I use custom skins and one of the columns is a datetime for Filtering?  I allow the grid to generate automatic columns.  The grid is not editable but you can filter.  As it is now, the filter icon has a link to the calendar popup but since I am using a custom skin none of the images are available.

I am hoping I can do something like this:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridFilteringItem)  
            {  
                  
                RadDateTimePicker picker = gridColumnEditor.PickerControl as RadDateTimePicker;    
                    picker.DatePopupButton.ImageUrl =  ".....  
 
            }  
 
        } 
 but I am not sure of the correct syntax.  I also don't know the column name since the columns are generated automatically.

Thanks

-Brent


0
Sebastian
Telerik team
answered on 13 Mar 2008, 04:17 PM
Hello sl6rp,

In order to access the RadDateTimePicker inside the column header (as part of the filtering item), try the following code intercepting the ItemCreated event of RadGrid:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)     
{     
            if (e.Item is GridFilteringItem)     
            {     
                foreach (GridColumn column in e.Item.OwnerTableView.AutoGeneratedColumns)  
                {  
                 if (typeof(System.DateTime) == column.DataType)  
                 {  
                  RadDateTimePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDateTimePicker;       
                  //Change the pop-up image url here
                  picker.DatePopupButton.ImageUrl =  ".....    
                 }   
                }  
    
            }     
    
}    
 

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sl6rp
Top achievements
Rank 1
answered on 13 Mar 2008, 04:48 PM
Thansk Stephen for the example.  I can't seem to get it to work though.

This is the error I get:
{  
Line 41:                         RadDateTimePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDateTimePicker;  
Line 42:                         picker.EnableEmbeddedSkins = false

The picker: 

Object reference not set to an instance of an object.

If I remove 

AllowFilteringByColumn

="true"

The error goes away but then I can't filter.

Here is my grid
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" Skin="DWDS" EnableEmbeddedSkins="false" ImagesPath="~/Skins/DWDS/Grid/" runat="server" GridLines="None" AllowPaging="true" ShowStatusBar="True"   
        PageSize="10" Width="100%" AllowSorting="True" ShowGroupPanel="True" OnItemCreated="RadGrid1_ItemCreated"    
        ClientSettings-AllowDragToGroup="true" ClientSettings-AllowColumnsReorder="true" ClientSettings-AllowExpandCollapse="true" ClientSettings-AllowGroupExpandCollapse="true" > 
        <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
        <ExportSettings IgnorePaging="true" FileName="File Export" /> 
        <MasterTableView DataSourceID="SqlDataSource1" AllowFilteringByColumn="true" HorizontalAlign="center" AutoGenerateColumns="True" DataKeyNames="TestDate" ShowFooter="true">  
            <ExpandCollapseColumn> 
                <HeaderStyle Width="25px" /> 
            </ExpandCollapseColumn> 
        </MasterTableView> 
    </telerik:RadGrid> 

Here is the codebehind:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridFilteringItem)  
            {  
                foreach (GridColumn column in e.Item.OwnerTableView.AutoGeneratedColumns)  
                {  
                    if (typeof(System.DateTime) == column.DataType)  
                    {  
                        RadDateTimePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDateTimePicker;  
                        picker.EnableEmbeddedSkins = false;  
                        picker.Skin = "DWDS";  
                        picker.DatePopupButton.ImageUrl = "~/Skins/DWDS/Calendar/DatePickerpopup.gif";  
                        picker.DatePopupButton.HoverImageUrl = "~/Skins/DWDS/Calendar/DatePickerpopupHover.gif";  
                        picker.TimePopupButton.ImageUrl = "~/Skins/DWDS/Calendar/Clock.gif";  
                        picker.TimePopupButton.HoverImageUrl = "~/Skins/DWDS/Calendar/ClockHover.gif";  
 
                        picker.Calendar.EnableEmbeddedSkins = false;  
                        picker.Calendar.Skin = "DWDS";  
                        picker.Calendar.NavigationPrevImage = "~/Skins/DWDS/Calendar/ArrowLeft.gif";  
                        picker.Calendar.NavigationNextImage = "~/Skins/DWDS/Calendar/ArrowRight.gif";  
                        picker.Calendar.FastNavigationNextImage = "~/Skins/DWDS/Calendar/fastNavRight.gif";  
                        picker.Calendar.FastNavigationPrevImage = "~/Skins/DWDS/Calendar/fastNavLeft.gif";  
                    }  
                }  
 
            }  
 
        } 
0
Sebastian
Telerik team
answered on 14 Mar 2008, 09:22 AM
Hello sl6rp,

It seems that I made a mistake by passing incorrect index to the Controls collection in my previous reply - excuse me for that.

Actually you will need to access the second control from the Controls collection of the header cell to get reference to the date picker in it, namely:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)        
{        
            if (e.Item is GridFilteringItem)        
            {        
                foreach (GridColumn column in e.Item.OwnerTableView.AutoGeneratedColumns)     
                {     
                 if (typeof(System.DateTime) == column.DataType)     
                 {     
                  RadDateTimePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[1] as RadDateTimePicker;          
                  //Change the pop-up image url here  
                  picker.DatePopupButton.ImageUrl =  ".....       
                 }      
                }     
       
            }        
       
}       
 

See the ItemCreated handler in this online demo for more info:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/Filtering/DefaultCS.aspx

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sl6rp
Top achievements
Rank 1
answered on 14 Mar 2008, 05:48 PM
Stephen,

I checked out the link you sent and changed the index as well.  I still get the same error.

I modified the code slightly to see what control id was being returned (if any). 
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridFilteringItem)  
            {  
                foreach (GridColumn column in e.Item.OwnerTableView.AutoGeneratedColumns)  
                {  
                    if (typeof(System.DateTime) == column.DataType)  
                    {  
                        GridFilteringItem filteringItem2 = e.Item as GridFilteringItem;  
                        Response.Write(filteringItem2[column.UniqueName].Controls[1].ID.ToString() + "<br>");  
                        Response.Write(filteringItem2[column.UniqueName].Controls[1].ClientID + "<br>");  
                        Response.Write(filteringItem2[column.UniqueName].Controls[1].GetType().ToString() + "<br>"); 


It finds the control to be of type RadDateInput and not a RadDateTimePicker.  While digging around I found that Control[0] was a RadDatePicker.  Once I changed this line:

RadDatePicker

picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDatePicker;

From a RadDateTimePicker to a RadDatePicker the error went away.  The Grid now shows the correct icons on the DatePopupButtons.  The Calendar still doesn't show the correct images but I understand that is being worked on on your end.

Thanks for the assistance.  Here is my final code for anyone who is interested:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridFilteringItem)  
            {  
                foreach (GridColumn column in e.Item.OwnerTableView.AutoGeneratedColumns)  
                {  
                    if (typeof(System.DateTime) == column.DataType)  
                    {  
                        RadDatePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDatePicker;  
                        picker.EnableEmbeddedSkins = false;  
                        picker.Skin = "DWDS";  
                        picker.DatePopupButton.ImageUrl = "~/Skins/DWDS/Calendar/DatePickerpopup.gif";  
                        picker.DatePopupButton.HoverImageUrl = "~/Skins/DWDS/Calendar/DatePickerpopupHover.gif";  
 
 
                        //this section still doesn't set the calendar icons yet but hopefully it will on the next prometheus release  
                        picker.Calendar.EnableEmbeddedSkins = false;  
                        picker.Calendar.Skin = "DWDS";  
                        picker.Calendar.NavigationPrevImage = "~/Skins/DWDS/Calendar/ArrowLeft.gif";  
                        picker.Calendar.NavigationNextImage = "~/Skins/DWDS/Calendar/ArrowRight.gif";  
                        picker.Calendar.FastNavigationNextImage = "~/Skins/DWDS/Calendar/fastNavRight.gif";  
                        picker.Calendar.FastNavigationPrevImage = "~/Skins/DWDS/Calendar/fastNavLeft.gif";  
                    }  
                }  
 
            } 

0
Kia
Top achievements
Rank 1
answered on 17 Mar 2008, 12:38 AM
I've done something pretty much the same in VB. Probably would have been stuck for a long time with the RadDatePicker and RadDateTimePicker issue if it wasn't for you. Thanks sl6rp.

I wonder though, what's the status with the nav images showing up on the calendar control? This is kind of very important to the system I'm working on at the moment and if this issue remains for too long I'll have to search for another solution.

Incidentally, my calendar is also transparent with no borders, which means that its pretty much not legible. I've tried adding the following lines(VB) which makes no difference at all.
<><><><><>
Picker.Calendar.BorderColor = Drawing.Color.Black 
Picker.Calendar.BorderStyle = BorderStyle.Solid 
Picker.Calendar.BackColor = Drawing.Color.White 

thanks,
Kia
0
Sebastian
Telerik team
answered on 17 Mar 2008, 08:00 AM
Hello Kia,

With the current official release of RadControls Prometheus (Q3 2007 SP2) you need to set the urls for the navigation images as explained by my colleague Dimo. For the Q1 2008 release we plan to introduce ImagesPath property for RadCalendar/RadDatePickers with which you will be able to set unified location for the pop-up and fast navigation images (similar to RadGrid Prometheus).

Regarding the border style and backcolor of the nested picker:
Can it be that the border styles set for the grid override your custom styles for the picker control? Does specifying CssClass for the Calendar and adding !important at the end of each style definitions from this class makes a difference? Consider inspecting the html of the page using IE developer toolbar to see whether your styles are applied as expected.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kia
Top achievements
Rank 1
answered on 17 Mar 2008, 01:59 PM
Hi Stephen,

Thanks for your response. I tried exactly what Dimo advised and with a bit of playing around managed to get only the Calendar popup image to appear on the grid. Here's the code I'm using:
        If (e.Item.IsInEditMode And TypeOf (e.Item) Is GridEditableItem) Or TypeOf (e.Item) Is GridFilteringItem Then 
            For Each column As GridColumn In e.Item.OwnerTableView.Columns 
                If GetType(DateIs column.DataType Then 
                    Dim Picker As New Telerik.Web.UI.RadDatePicker 
                    Picker = TryCast((TryCast(e.Item, Telerik.Web.UI.GridFilteringItem))(column.UniqueName).Controls(0), Telerik.Web.UI.RadDatePicker) 
                    If Picker.EnableEmbeddedSkins = False Then 
                        Picker.DatePopupButton.ImageUrl = "~/RadControls/Skins/GluckVision/Calendar/DatePickerpopup.gif" 
                        Picker.DatePopupButton.HoverImageUrl = "~/RadControls/Skins/GluckVision/Calendar/DatePickerpopupHover.gif" 
 
                        Picker.Calendar.EnableEmbeddedSkins = False 
                        Picker.Calendar.NavigationPrevImage = "~/RadControls/Skins/GluckVision/Calendar/arrowLeft.gif" 
                        Picker.Calendar.NavigationNextImage = "~/RadControls/Skins/GluckVision/Calendar/arrowRight.gif" 
                        Picker.Calendar.FastNavigationNextImage = "~/RadControls/Skins/GluckVision/Calendar/fastNavRight.gif" 
                        Picker.Calendar.FastNavigationPrevImage = "~/RadControls/Skins/GluckVision/Calendar/fastNavLeft.gif" 
                        Picker.Calendar.BorderColor = Drawing.Color.Black 
                        Picker.Calendar.BorderStyle = BorderStyle.Solid 
                        Picker.Calendar.BackColor = Drawing.Color.White 
                    End If 
                End If 
            Next 
        End If 
 

When I right click on the missing image and view properties, I still see that it is pointing to the root folder of the website. The very same issue sl6rp had above.

Also I'm not sure what exactly you mean in regards to CSS and the calendar borders? Do you mean create a new skin with its own CSS elements for the calendar? I have one CSS for the site which contains modifications for the custom skin. I tried removing those elements from the CSS and removed the call to the skin from the grid's Skin property, but still had the same issue. At that time I had no other CSS elements referring to the Grid OR Calendar. This happens only when I set "EnableEmbeddedSkins" to False.


Thanks,
Kia
0
sl6rp
Top achievements
Rank 1
answered on 17 Mar 2008, 02:26 PM
Stephen, Kia,

Sorry I ddin't reply sooner but I wanted to make sure I had checked my code before responding. 

I have not been able to get the images on the calendar to work.  I can get the custom skin (background colors, text sizes, etc) to pull from my style sheet but I can't get the images to show no matter what I have tried.

This is what Dimo said in another one of my posts (http://www.telerik.com/community/forums/thread/b311D-bcbkcb.aspx) about the skins not showing in a grid scenario:

______________________________________________________

Hi Brent,

Regarding the RadCalendar images - it seems that currently you can set custom navigation images only if EnableEmbeddedSkins is set to False. This is a bug which we will fix for the next release. Sorry for the inconvenience. Your account has been updated with 500 Telerik points for bringing this issue to our attention.

<I cut some text out here that didn't apply to this problem - Brent>

All the best,
Dimo
the Telerik team

___________________________________________

I wish I knew when that next release will be (any idea Stephen?).  I have moved all of my applications to the Prometheus controls and this is one of the few items holding me back from releasing them.

-Brent

0
Sebastian
Telerik team
answered on 17 Mar 2008, 02:30 PM
Hi guys,

The ETA for the next release of RadControls Prometheus is in the middle of April. I hope that the timeframe for it will not put your project development on hold. In the meantime please excuse us for the temporary inconvenience.

Kind regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sl6rp
Top achievements
Rank 1
answered on 17 Mar 2008, 02:41 PM
Stephen,

Thanks for replying so quickly.  I was hoping to finish up the last of my changes and the QA by the end of this week, maybe next at the lastest.  So, if a hotfix becomes available for the calendar and/or grid before the next release with these items fixed I would be very interested.

Thanks

-Brent

Kia,

Did you get your stylesheet working?  If not send me an email at brentndavis @ gmail.com and I'll see if there is anything I can help with.

-Brent
0
Sebastian
Telerik team
answered on 17 Mar 2008, 02:52 PM
Hello sl6rp,

We will notify you as soon as we come up with results. We will do our best to include the requested fix for the RadControls Futures release (something like beta version before the official Q1 2008 release), expected at the beginning of the next week.

Kind regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kia
Top achievements
Rank 1
answered on 18 Mar 2008, 03:36 AM
Thanks Stephen and the rest of the Telerik staff. You provide great service and information. I'm log forward to the update.

Brent, thanks for the offer. I might take you up on that offer. I still have had no progress.

Kia
0
sl6rp
Top achievements
Rank 1
answered on 25 Mar 2008, 02:10 PM
Stephen,

Is there any news on the Futures release for this week?

Thanks

-Brent
0
Richard
Top achievements
Rank 1
answered on 25 Mar 2008, 10:08 PM
I just installed the Q1-08 Futures release and was *very* disappointed to see that the Date/Time column editor still does not skin properly.  It is still looking for the images in the same folder as the page instead of in the folder specified in ImagesPath for the skin :(
0
Dimo
Telerik team
answered on 26 Mar 2008, 02:25 PM
Hello,

Setting custom navigation images for RadCalendar with EnableEmbeddedSkins="true", as well as obeying the ImagesPath property will start working in Q1 2008.

Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kia
Top achievements
Rank 1
answered on 02 Apr 2008, 12:41 AM
I find the same problem. I think this is still not fixed in Q1 2008.
0
Dimo
Telerik team
answered on 02 Apr 2008, 07:38 AM
Hello,

Actually Q1 2008 has not been released yet :)

Greetings,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kia
Top achievements
Rank 1
answered on 03 Apr 2008, 05:21 AM
My bad. I meant the preview for such a version.
0
Richard
Top achievements
Rank 1
answered on 16 Apr 2008, 09:49 PM
Ok, the calendar and datetimepicker now seem to be working, but the Date/TimeColumnEditors are still a problem.  Are there any plans to fix this?  It is very ugly to have to set the image path in code every time I use a Date/Time column!
0
plamen
Top achievements
Rank 1
answered on 17 Apr 2008, 10:54 AM
hi:)


You can use the ItemDatatBound event handler


Here is an example:

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode) 
        { 
            GridEditFormItem gridEditFormItem = (GridEditFormItem)e.Item; 
 
            RadDatePicker radDatePicker =  
                (RadDatePicker)gridEditFormItem["Column_0"].Controls[0]; 
 
            radDatePicker.ImagesPath = "~/MyImagesPath/"
             
        } 
    } 


Regards...
<John:Peel />
0
Richard
Top achievements
Rank 1
answered on 17 Apr 2008, 08:30 PM
Thanks John, but you kind of missed my point :)

I already do as you suggest, but that is an ugly solution.  I would like to see a nice clean solution - the pickers obeying the ImagesPath property that I set in my skin without requiring any code behind.

[Edited for clarity]
0
Dimo
Telerik team
answered on 18 Apr 2008, 05:28 AM
Hi Richard,

Currently RadGrid and RadCalendar have some images with the same names. Unfortunately, this means that RadCalendar should not inherit the ImagesPath property from RadGrid, as this will lead to unexpected results.

We will consider implementing a cleaner solution in the future. This could require some breaking changes for lots of people, so we must be careful. Thank you for understanding.

Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Richard
Top achievements
Rank 1
answered on 18 Apr 2008, 01:48 PM
Would it not be possible to have the GridDateTimeColumnEditor control expose the ImagesPath property of its picker control?  That way there is no conflict as it would use the images from the Calendar and not from the Grid.
0
Missing User
answered on 21 Apr 2008, 01:28 PM
Hello Richard,

We absolutely agree that the ability to set the GridDateTimeColumnEditor.ImagesPath property is a very convenient addition, so will implement this functionality in the next SP release, expected in the middle of May.

Greetings,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Guss
Top achievements
Rank 2
answered on 24 May 2008, 12:22 PM
So for those using the newest SP, and does not use Auto-generated columns, here is the sort version:

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridFilteringItem) 
        { 
            foreach (GridColumn column in e.Item.OwnerTableView.Columns) 
            { 
                if (typeof(System.DateTime) == column.DataType) 
                { 
                    RadDatePicker picker = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0] as RadDatePicker; 
                    picker.ImagesPath = "~/Styles/Calendar/"
                } 
            } 
        } 
    } 

Regards
Guss
0
Sompop
Top achievements
Rank 1
answered on 07 Sep 2011, 09:20 PM
Hi there,

For me, when I try to edit multiple records, the date icon for the selected row in edit more for the grid will show only the last record. Please see the screenshot. How do I get icons for every selected records like the last record during edit mode?

Thank you,

Below is the .aspx code and .aspx.cs code.

.aspx

<telerik:RadGrid ID="rgQuoteItems" runat="server" Height="600px" Style="overflow: hidden"

   AllowMultiRowEdit="True" AllowMultiRowSelection="True" AllowAutomaticUpdates="true"

   AllowAutomaticDeletes="true" AllowAutomaticInserts="false" PageSize="100" Skin="Gray"

   AllowPaging="true" AllowSorting="true" GridLines="none" DataSourceID="SQLDS_QuoteItems"

   AllowFilteringByColumn="true" AutoGenerateColumns="false" HeaderStyle-HorizontalAlign="center" OnItemCreated="rgQuoteItems_ItemCreated">

   <PagerStyle Mode="NextPrevNumericAndAdvanced" />

   <MasterTableView DataSourceID="SQLDS_QuoteItems" DataKeyNames="quoteItemGuid" CommandItemDisplay="Top"

      EditMode="InPlace">

   <Columns>

      <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-Width="20px" Visible="false">

      <ItemTemplate>

         <asp:HyperLink ID="hlQuoteItem" runat="server" Text="Edit" ImageUrl="~/RadControls/Gray/Grid/Edit.gif" />

      </ItemTemplate>

      </telerik:GridTemplateColumn>

      <telerik:GridBoundColumn SortExpression="interval" HeaderText="Interval" DataField="interval"

         UniqueName="interval" DataType="System.Int32" ItemStyle-HorizontalAlign="center"

         FilterControlWidth="40px" ColumnEditorID="gridNumericTextBoxColumnEditor" />

      <telerik:GridDateTimeColumn HeaderText="Due Date" DataField="nextCalDueDate" SortExpression="nextCalDueDate"

         UniqueName="nextCalDueDate" FilterControlWidth="60px" DataFormatString="{0:MM/dd/yyyy}"

         ColumnEditorID="gridDateTimeColumnEditor" />

      <telerik:GridBoundColumn SortExpression="price" HeaderText="Price" DataField="price"

         UniqueName="price" DataType="System.Double" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="right" FilterControlWidth="40px" ReadOnly="true" />                               

      <telerik:GridBoundColumn HeaderText="quoteItemGuid" DataField="quoteItemGuid" SortExpression="quoteItemGuid" UniqueName="quoteItemGuid" Visible="false" />

    </Columns>

    <CommandItemTemplate>

       <div style="padding: 0 5px;">

          <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# rgQuoteItems.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/Edit.gif" />Edit selected</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# rgQuoteItems.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/Update.gif" />Update</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# rgQuoteItems.EditIndexes.Count > 0 || rgQuoteItems.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/Cancel.gif" />Cancel editing</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# rgQuoteItems.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/AddRecord.gif" />Add new</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# rgQuoteItems.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/AddRecord.gif" /> Add this quote item</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:if(!confirm('Are you certain you want to delete the selected quote item(s)?')){return false;}" runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/Delete.gif" />Delete selected quote items</asp:LinkButton>&nbsp;&nbsp;

          <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../../RadControls/Gray/Grid/Refresh.gif" />Refresh quote item list</asp:LinkButton>

       </div>

     </CommandItemTemplate>

   </MasterTableView>

   <GroupPanel Visible="True">

   </GroupPanel>

   <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True"

      ColumnsReorderMethod="reorder">

      <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />

      <Resizing AllowColumnResize="False"></Resizing>

      <Scrolling AllowScroll="True" UseStaticHeaders="False" SaveScrollPosition="True" />

   </ClientSettings>

   <GroupingSettings CaseSensitive="false" />

</telerik:RadGrid>

<telerik:GridTextBoxColumnEditor ID="gridTextBoxColumnEditor" TextBoxStyle-Width="100px"

                        runat="server" />

<telerik:GridTextBoxColumnEditor ID="gridNumericTextBoxColumnEditor" TextBoxStyle-Width="60px"

                        runat="server" />

<telerik:GridDateTimeColumnEditor ID="gridDateTimeColumnEditor" TextBoxStyle-Width="80px"

                        runat="server" />


.aspx.cs (I tried to use from the thread above but not working.)

protected void rgQuoteItems_ItemCreated(object sender, GridItemEventArgs e)

        {

            if (e.Item is GridEditableItem && e.Item.IsInEditMode)

            {

                GridDateTimeColumnEditor gridColumnEditor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("nextCalDueDate") as GridDateTimeColumnEditor;

                if (gridColumnEditor != null)

                {

                    RadDateTimePicker picker = gridColumnEditor.PickerControl as RadDateTimePicker;

                    //picker.DatePopupButton.ImageUrl = "~/RadControls/Gray/DatePicker/Gray.gif";

                    //picker.DatePopupButton.ImageUrl = "../../RadControls/Gray/DatePicker/Gray.gif";

                    //picker.ImagesPath = "../../RadControls/Gray/DatePicker/";

                    Label1.Text = Convert.ToString(int.Parse(Label1.Text) + 1);

                }

            }

        }


Error that I got. I know the picker got generate as many as selected records that I selected. However, when I use .ImagesPath or .ImageUrl, this error occurs.

Server Error in '/xTrakLocalhost' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

Line 183:                    //picker.DatePopupButton.ImageUrl = "~/RadControls/Gray/DatePicker/Gray.gif";

Line 184:                    //picker.DatePopupButton.ImageUrl = "../../RadControls/Gray/DatePicker/Gray.gif";

Line 185:                    picker.ImagesPath = "../../RadControls/Gray/DatePicker/";

Line 186:                    Label1.Text = Convert.ToString(int.Parse(Label1.Text) + 1);

Line 187:                }


Source File: C:\Inetpub\wwwroot\mydomain\Main\Customers\QuoteDetails.aspx.cs    Line: 185 

0
Bodevain Svensson
Top achievements
Rank 1
answered on 08 Sep 2011, 08:57 AM
That's pretty odd - can you check that you are using the latest and greatest 2011.2.712 version of the telerik Ajax controls? Also test whether this happens only when you disable the embedded skins and use ImagesPath for the picker, or not. Let me know what your findings are, I will do my best to assist.

Bodevain
0
Sompop
Top achievements
Rank 1
answered on 08 Sep 2011, 04:42 PM
Hi Bodevain,

When I took the skin out, the icons show up correctly. If so, what did I do wrong?

Regards,

Sompop
0
Bodevain Svensson
Top achievements
Rank 1
answered on 08 Sep 2011, 05:14 PM
Sompop, do you confirm that you use the latest version I pointed? If this does not help, investigate what is wrong with the setup of ImagesPath and the actual popup images, there you will find the culprit.

Bodevain
0
Sompop
Top achievements
Rank 1
answered on 08 Sep 2011, 10:06 PM
Hi Bodevain,

I am currently using Q3 2008 and my manager has not approved a budget to renew it yet. We plan to recreate our web app in the future. Before that time, I have to use the current version I have.

Anyway, I found out the solution from the link below.

http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/shareddatepicker/defaultcs.aspx?product=grid


I don't fully understand how it is like that, but all I did was to put one RadDatePicker somewhere in the web page and add three javascripts. Even though, it is not exactly the same as the link tro to make the shared RadDatePicker with TextBox, but it worked.

Thank you again for your help.

Regards,

Sompop
0
test
Top achievements
Rank 1
answered on 17 May 2013, 09:49 AM
HI,

I have a default.aspx page and I have set of user controls say Control1.ascx and Control2.ascx so on.
I am loading this user control through an Ajax - (Web service call).This ajax call is made from the default.aspx page.
on "pageLoad()" - Javascript.

This web service returns me the constructed usercontrol html tags,Which I am appending it to a div tag client side(Jquery

Append).

Problem:

When I append,I see that Control1.ascx contains a RadCalender control.On border I see "corner round" image missing.

Please help me out how to resolve it.


Thanks...
Tags
Grid
Asked by
Kia
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Kia
Top achievements
Rank 1
Sebastian
Telerik team
sl6rp
Top achievements
Rank 1
Richard
Top achievements
Rank 1
plamen
Top achievements
Rank 1
Missing User
Guss
Top achievements
Rank 2
Sompop
Top achievements
Rank 1
Bodevain Svensson
Top achievements
Rank 1
test
Top achievements
Rank 1
Share this question
or