Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
191 views
My site has a lot of grids for which we do specialized formatting, especially for date/time and currency data. Although it works to use GridTemplateColumns and use Eval statements to do the special formatting, it's becoming increasingly unwieldy to write all those template columns. Therefore, we have created a column class inherited from GridBoundColumn. The primary purpose of this column is to override FormatDataValue with our custom formatting:

protected override string FormatDataValue(object dataValue, GridItem item)
{
    return FormatString(dataValue, DataBinder.GetDataItem(item));
}
 
protected virtual string FormatString(object dataValue, object DataItem)
{
    if (dataValue != null)
    {
        String lc = LanguageCodeField.HasValue()
                            ? DataBinder.Eval(DataItem, LanguageCodeField).ToString()
                            : String.Empty;
        CultureInfo ci = lc.HasValue()
                                 ? new CultureInfo(lc)
                                 : CultureInfo.CurrentCulture;
 
        if(DataFormatString.HasValue())
        {
            return String.Format(ci, DataFormatString, dataValue);
        }
        if (dataValue is DateTime)
        {
            return Dates.GetShortDateTimeString(dataValue as DateTime?);
        }
        if(IsCurrency)
        {
            double dv = Convert.ToDouble(dataValue);
 
            return Cultures.FormatCurrencyValue(lc, dv);
        }
 
        return String.Format(ci, "{0}", dataValue);
       
    }
    return String.Empty;
}
Note: HasValue = !String.IsNullOrEmpty; and Dates.GetShortDateTimeString and Cultures.FormatCurrencyValue are our standard formatting functions for dates and currencies, respectively. LanguageCodeField is a property that we added to our column in order to allow our DataTable to specify different currencies/date formats on a row-by-row basis, and we assume that it will eval to culture strings like "en-US".

Our big problem now is that the Grid Footers aren't applying our formatting. They apparently don't run through FormatDataValue. Here's the code for our column and the GridBoundColumn and I've attached a screen shot that shows the difference when LangaugeCodeField evaluates to "en-GB" even though my computer's culture is the US. (Note: We only enable the footer when LanguageCodeField is the same for all rows -- that's not an issue. If we need to aggregate it, too, we can use "first" with no problem.)
<cc2:MyBoundColumn HeaderText="[Total New]" UniqueName="TOTALEXPENSECALC2" DataField="TOTALEXPENSE" Resizable="false" Reorderable="false"
     LanguageCodeField="LANGUAGECODE" Aggregate="Sum" FooterStyle-CssClass="textbold" FooterText="Page Total " />
<telerik:GridBoundColumn HeaderText="[Total Standard]" UniqueName="TOTALEXPENSECALC3" DataField="TOTALEXPENSE" Resizable="false" Reorderable="false"
      Aggregate="Sum" FooterStyle-CssClass="textbold" FooterText="Page Total " DataFormatString="{0:C}"  />

As you can see in the screen shot, the "Footer Text" property and CssClass are applying properly (Yay!), but we need the Total itself to be formatted in the correct currency. Please help us figure out what to override or what event we have to tie into in order to make custom formatting work for the footer of our inherited column.

--Christina
Radoslav
Telerik team
 answered on 23 Aug 2011
1 answer
77 views
  1. ASP.NET 3.5
  2. OS:  Code runs on Windows Server 2008. IE 8 is on Windows 7 Professional.
  3. Browser:  IE 8
  4. Telerik product version:  RadControls for ASP.NET AJAX Q2 2011.
  5. Preferred programming language:  VB.NET

 
How can I:
1. Add new pagesize values to the RadDataPagerPageSizeField drop-down?
2. Remove, or replace, the hard-coded values?

Pavlina
Telerik team
 answered on 23 Aug 2011
1 answer
122 views

I Have desigend a Master Page whcih holds RADWindowManager and RADWindow control, but when I try tom resize the window it gets resized only Horizontally. Height doesn't get changed need help: Tried both SetSize(0 and SetHeight()

 

function OpenCreateVirtualFarmWindow(button, args) {  

var oManager = GetRadWindowManager();  

var oWnd = oManager.getWindowByName("CaasRADWindow");  

//oWnd.SetSize(400, 400);  

oWnd.SetHeight(1000);

oWnd.SetWidth(400); 

oWnd.SetUrl(

"/CaasCustomerPortal/CreateNewFarm.aspx");  

oWnd.Show(); 

return false

//CreateAndShowModal('/CreateNewFarm.aspx', 'Modal1', 'Default Window at 450 pixels wide', 450);

 

}

Marin Bratanov
Telerik team
 answered on 23 Aug 2011
1 answer
206 views
Hi,

We are using rad input fields throughout our application.  At various times, we disable these fields based on security, etc.  We tried the sample code below in IE and Safari.  The two browsers display differently.  In IE the input values are still readable, however in Safari they are too light.  Is there a way to update the .riDisabled class so the color can be darker?  We need to update this across our application.

Thanks,
Lindsay

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <title>HI MIKE</title>
</head>
<style type="text/css"
HTML BODY .RadInput .riTextBox
{
    border-bottom: 1px solid;
    border-left: 1px solid;
    padding-bottom: 3px;
    padding-left: 1px;
    padding-right: 1px;
    border-top: 1px solid;
    border-right: 1px solid;
    padding-top: 2px;
}
.RadInput_Office2007
{
    font: 12px "segoe ui", arial, sans-serif;
}
HTML BODY .RadInput_Office2007 .riTextBox
{
    border-bottom-color: #abc1de;
    border-top-color: #abc1de;
    font: 12px "segoe ui", arial, sans-serif;
    background: #fff;
    color: #000;
    border-right-color: #abc1de;
    border-left-color: #abc1de;
}
HTML BODY .RadInput_Office2007 .riDisabled
{
    border-bottom-color: #ccdbed;
    border-top-color: #ccdbed;
    color: #8d8d8d;
    border-right-color: #ccdbed;
    border-left-color: #ccdbed;
    cursor: default;
}
</style>
   
<body>
    <input id="Text1" type="text" value ="Disabled" disabled="disabled"  />
    <br />
    <input id="Text2" type="text" value ="Read Only" readonly="readonly" />
    <br />
    <span id="ctl02_ctl01_OBJ_FIRSTNAME_wrapper" class="RadInput RadInput_Office2007" style="white-space:nowrap;">
        <input value="rtyrty" type="text" maxlength="25" size="20" id="ctl02_ctl01_OBJ_FIRSTNAME_text" 
            name="ctl02_ctl01_OBJ_FIRSTNAME_text" class="riTextBox riDisabled" disabled="disabled" style="width:25ex;" />
    </span>        
</body>
</html>
Tsvetina
Telerik team
 answered on 23 Aug 2011
4 answers
101 views
Hi,
I am usiing radgrid in one of my page. In this grid there are 2 columns . One of the column is datetime. I have used GridDateTime column. There are custom filter and custom paging in this page. when I filter some data in datetime column like GeaterThanEqualTo the datasource take correct records from sql query. After binding the grid and setting virtual count the Grid1.Items.Count is showing wrong number of records or Grid1.MasterTableview.items.count also shows incorrect no of records. Paging is showing perfectly. But record displayed is incorrect. Also the datasource shows correct rows. Please provide solution for this as soon as possible.

sandesh
Maria Ilieva
Telerik team
 answered on 23 Aug 2011
6 answers
181 views
I put RadTreeView In RadWindow,  code blow:

RadTreeView:
          <telerik:RadTreeView ID="rtvRules" runat="server"   Height="240px"  Width="250px"  />
RadWindow:
          <telerik:RadWindow ID="rwDetail" runat="server" Behaviors="Close, Pin, Move"  Modal="true" Width="300px"
                    Height="350px"  VisibleStatusbar="False" >

I get data from database and fill this treeview, then  expand nodes .  Now The window show vertical scroll bar.
(btw, I use the window loading a page , the treeview is in the page .)
I put the treeview in div .
<div style="overflow:hidden;width: 260px; height: 250px; />

but The window still show vertical scroll bar.

why? pls help me.
                                                                                                        
Marin Bratanov
Telerik team
 answered on 23 Aug 2011
5 answers
137 views
Hi Telerik,

I am messing around with some proof of concept stuff and I was wondering if it possible to treat a RadWindow as a RadDock such that it is dockable, or store the RadWindow inside of the RadDock in such a way that a Silverlight control would be able to run inside of the RadWindow.

Ideally, the RadWindow would not be visible, only the content inside of it is visible. Really, what I want is a TargetURL for a RadDock.

Is something along these lines possible? I've got the window open with our silverlight running inside of it, but it's not pinned to the dock.

Sean
Marin Bratanov
Telerik team
 answered on 23 Aug 2011
1 answer
96 views
I'm trying to setup paging for RadGrid and it works fine in some scenarios but there are 3 issues with it:

@  Load the page initially, go to the second page, then go back to the first page; the data is not updated so shows the second page data!

@ Load the page initially, change the page size from 10 to 50. expect: the page should immediately be reloaded with the new page size. actual: no change. generally something wrong with the first page!

@ pdf icon disappears when clicking any page number apart from the first. It appears again when the first page number is clicked but the data has the above issue.

Maybe it's not configured properly (it's generated using my RadGridBuilder class). I have set the below properties:

            this.RadGrid.AllowPaging = this.AllowPaging;
            this.RadGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;

private void RadGridNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            this.RadGrid.DataSource = this.DataSource;
        }

My Build method is responsible to buld the RadGrid basically:

 public RadGrid Build()
        {
            this.DataSource = GetDataSource();

            SetImmediateProperties();

            SetMasterTableView();

            ConfigureExportSettings();

            this.RadGrid.Rebind();

            return this.RadGrid;
        }

Why do I have the above issues and how to resolve them?

After further investigation, it's clarified that PageIndexChanged event is never raised when the page number 1 is clicked. Not sure why?

Very much appreciated.
Iana Tsolova
Telerik team
 answered on 23 Aug 2011
3 answers
67 views
I need to add user names and their appointments in the timeline view so in order to achieve that I am adding ResourceTypes to the scheduler in the following manner:

<asp:SqlDataSource ID="sqlMain" runat="server"></asp:SqlDataSource>
<asp:SqlDataSource ID="sqlUsers" runat="server"></asp:SqlDataSource>
<telerik:RadScheduler ID="radSchedule1" runat="server" Height="100%"
MinutesPerRow="15" Skin="Web20" StartInsertingInAdvancedForm="True"
AdvancedForm-Modal="True" AdvancedForm-Width="400px" TimelineView-GroupBy="Users" TimelineView-GroupingDirection="Vertical"  FirstDayOfWeek="Monday" SelectedView="WeekView" Localization-HeaderWeek="Work Week">
<ResourceTypes>
    <telerik:ResourceType KeyField="UserId" Name="Users" TextField="Name" ForeignKeyField="UserId" DataSourceID="sqlUsers" />
</ResourceTypes>
<AdvancedInsertTemplate>
  ......
</AdvancedInsertTemplate>
<AdvancedEditTemplate>
  ......
</AdvancedEditTemplate>
</telerik:RadScheduler>

As soon as I add the <ResourceTypes> part the scheduler navigation stops working (Day, Week, Month, Timeline and others). Would could be causing this behavior? Thanks
Plamen
Telerik team
 answered on 23 Aug 2011
3 answers
49 views
Hello,

I have a telerik grid that contains japonese text in its columns contents.
It's ok, but when the user try to use the default functionallity to export the content to pdf format, the japonese characters are showed as "#" characters.

How can I fix this?

Regards
Princy
Top achievements
Rank 2
 answered on 23 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?