向UltraWebGrid中绑定WebDateChooser

To place a date chooser control on ultra web grid is a simple task. But one thing u have to care of is that before grid binding u have to bind the edit control with column. Else you will waste your time like. I try different things but in the end i find out this solutions to bind that control with grid before you bing grid with dataset. There is no need to bind it on InitializeRow or InitializeLayout Event. Below is the sample code,

In aspx page

I replace the html < > with [ ]

“[igtbl:UltraWebGrid Style=”left: 53px; top: -3px” ID=”Grid” Height=”150px Width=”100%”]
[Bands]
[igtbl:UltraGridColumn AllowUpdate=”Yes” BaseColumnName=”RequiredDate” CellButtonDisplay=”Always”
DataType=”System.DateTime” Format=”M/d/yyyy” Key=”RequiredDate” Type=”Custom” EditorControlID=”GridDateChooser”]
[HeaderStyle HorizontalAlign=”Center” /]
[Header Caption=”Required Date”]
[RowLayoutColumnInfo OriginX=”25″ /]
[/Header]
[CellStyle HorizontalAlign=”Center”]
[/CellStyle]
[Footer]
[RowLayoutColumnInfo OriginX=”25″ /]
[/Footer]
[/igtbl:UltraGridColumn]
[/Bands]
[/igtbl:UltraWebGrid]
[igsch:WebDateChooser ID=”GridDateChooser” runat=”server” ForeColor=”BLACK”
Font-Size=”10px” NullDateLabel=”" ]
[CalendarLayout AllowNull=”False”]
[SelectedDayStyle CssClass=”InfraCalenderSelectedDate” /]
[CalendarStyle BackColor=”#6699CC” CssClass=”InfraCalendarStyle” /]
[DayHeaderStyle BackColor=”White” Font-Names=”Verdana” ForeColor=”Black” /]
[/CalendarLayout]
[DropButton ImageUrl1=”~/Img/calender.gif”]
[/DropButton]
[/igsch:WebDateChooser]”

Now in ur code file here are the two lines you have to write before binding the grid with dataset

Grid.Columns.FromKey(”RequiredDate”).Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;
Grid.Columns.FromKey(”RequiredDate”).EditorControlID = “GridDateChooser”;

你可能感兴趣的:(Date)