I have an UltraWebGrid (below) that is dynamically bound by Dataset server-side. I need it to have a row edit template with textbox, dropdownlist, and datepicker. I have several problems: 1) I cannot initialize the controls, like prefilling the dropdownlist, 2) I cannot set the initial values to the controls or get the changed values from them, 3) I have to do everything server-side in the code-behind, I cannot manipulate the data client-side, so no javascript. I've tried the various grid methods like updaterow, updategrid, etc., but cannot capture the right event(s). I am using vb.net 2008 with ig controls v10.3.20103.2134. I also cannot use the newer WebDataGrid, this has to be UltraWebGrid for now. I need to have something working correctly soon, so any help or simple example would be hugely appreciated. Thanks so much.
<igtbl:UltraWebGrid ID="igGrid" runat="server" DisplayLayout-AutoGenerateColumns="true"EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/"DisplayLayout-CellPaddingDefault="5" DisplayLayout-AllowSortingDefault="No"><Bands><igtbl:UltraGridBand><AddNewRow View="NotSet" Visible="NotSet"></AddNewRow></igtbl:UltraGridBand></Bands><DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igStop" RowHeightDefault="20px" Version="4.00" CellClickActionDefault="Edit" AllowUpdateDefault="Yes"><FrameStyle></FrameStyle><ActivationObject BorderColor="" BorderWidth=""></ActivationObject></DisplayLayout></igtbl:UltraWebGrid>
Hello dbishop9,
Thank you for posting in our forum.
If you don’t want to use any JS you’ll have to use the WebDateChooser control instead of the WebDatePicker since the latter is part of the Akido controls set and is better integrated with the new WebDataGrid .You can still use it but you’ll have to handle client side events to get and set the value of the corresponding cell you want to edit. For the WebDateChooser these client side events are already handled so you don’t need to write additional JS.
I’m attaching a sample for your reference. Please test it on your side and let me know if you have any concerns or questions.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Maya, below is what I have (it won't let me add an attachment). I have a couple of problems; 1) the edit template is aligned to the top of the row, not the bottom, which causes part of it to be off screen and it won't scroll up, 2) the dropdowns are not popluated. I followed your example, but I must not be doing something right. Please help. Also, how do I get the data from the controls in the edit template? Thanks
<igtbl:UltraWebGrid ID="igAction" runat="server" EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" DisplayLayout-CellPaddingDefault="5" OnUpdateRow="igActions_UpdateRow"><Bands><igtbl:UltraGridBand><Columns><igtbl:UltraGridColumn BaseColumnName="ID" Key="ID"></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Process" Key="Process"><Header><RowLayoutColumnInfo OriginX="2" /></Header><Footer><RowLayoutColumnInfo OriginX="2" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Action Item" Key="Action Item"><Header><RowLayoutColumnInfo OriginX="3" /></Header><Footer><RowLayoutColumnInfo OriginX="3" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Action Type" Key="Action Type"><Header><RowLayoutColumnInfo OriginX="4" /></Header><Footer><RowLayoutColumnInfo OriginX="4" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Status" Key="Status"><Header><RowLayoutColumnInfo OriginX="5" /></Header><Footer><RowLayoutColumnInfo OriginX="5" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Assigned To" Key="Assigned To"><Header><RowLayoutColumnInfo OriginX="6" /></Header><Footer><RowLayoutColumnInfo OriginX="6" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Due Date" Key="Due Date" Format="MM/dd/yyyy"><Header><RowLayoutColumnInfo OriginX="7" /></Header><Footer><RowLayoutColumnInfo OriginX="7" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="Completion Date" Key="Completion Date" Format="MM/dd/yyyy"><Header><RowLayoutColumnInfo OriginX="8" /></Header><Footer><RowLayoutColumnInfo OriginX="8" /></Footer></igtbl:UltraGridColumn><igtbl:UltraGridColumn BaseColumnName="DATE" Key="DATE"><Header><RowLayoutColumnInfo OriginX="9" /></Header><Footer><RowLayoutColumnInfo OriginX="9" /></Footer></igtbl:UltraGridColumn></Columns><RowEditTemplate><p align="left"><asp:DropDownList ID="ddlActionProcess" runat="server" columnkey="Process" DataTextField="Process" OnInit="ddlActionProcess_Init"></asp:DropDownList><input id="txtActionItem" columnkey="Action Item" style="width:150px;" type="text" /><asp:DropDownList ID="ddlActionItem" runat="server" columnkey="Action Item" DataTextField="Action Item"OnInit="ddlActionItem_Init"></asp:DropDownList><asp:DropDownList ID="ddlActionStatus" runat="server" columnkey="Status" DataTextField="Status"OnInit="ddlActionStatus_Init"></asp:DropDownList><input id="txtActionAssignedTo" columnkey="Assigned To" style="width: 100px;" type="text" /><igsch:WebDateChooser ID="igActionDueDate" columnkey="Due Date" runat="server" NullDataLabel="Select a Date" Format="Short" OnInit="igActionDueDate_Init"></igsch:WebDateChooser><igsch:WebDateChooser ID="igActionCompletionDate" columnkey="Completion Date" runat="server" NullDataLabel="Select a Date"Format="Short" OnInit="igActionCompletionDate_Init"></igsch:WebDateChooser><igsch:WebDateChooser ID="igActionDate" columnkey="DATE" runat="server"NullDataLabel="Select a Date" Format="Short" OnInit="igActionDate_Init"></igsch:WebDateChooser><br /><br /></p><br /><p align="center" ><input id="igAction_reOkBtn" onclick="igAction_gRowEditButtonClick(event);" style="width: 50px;"type="button" value="OK"> <input id="igAction_reCancelBtn" onclick="igAction_gRowEditButtonClick(event);" style="width: 50px;"type="button" value="Cancel"> </input></input></p></RowEditTemplate><AddNewRow View="NotSet" Visible="NotSet"></AddNewRow></igtbl:UltraGridBand></Bands><DisplayLayout Name="igAction" AllowDeleteDefault="Yes" AllowSortingDefault="No" AllowUpdateDefault="RowTemplateOnly" BorderCollapseDefault="Separate" CellPaddingDefault="5" AutoGenerateColumns="false" RowSelectorsDefault="No" RowHeightDefault="20px" Version="4.00" CellClickActionDefault="Edit" SelectTypeRowDefault="Extended" StationaryMargins="Header" TableLayout="Fixed" ><FrameStyle></FrameStyle><ActivationObject BorderColor="" BorderWidth=""></ActivationObject></DisplayLayout></igtbl:UltraWebGrid>
********************************************************
Imports SystemImports System.DataImports System.Data.SqlClientImports System.Collections.GenericImports System.WebImports System.Web.UIImports System.Web.UI.WebControlsImports InfragisticsImports Infragistics.WebUIImports Infragistics.WebUI.UltraWebGridImports Infragistics.WebUI.WebSchedule
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadSetSubtitle()If Not IsPostBack ThenResponse.Cache.SetNoServerCaching()Response.Cache.SetCacheability(HttpCacheability.NoCache)ClearCache()LoadData()End If
End Sub Private Sub LoadData()Dim ds As New DataSetTryds = GetActionDataSet()igAction.DataSource = dsigAction.DataBind()Catch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionProcess_Init(ByVal sender As Object, ByVal e As EventArgs)TryDim d As DropDownList = DirectCast(sender, DropDownList)Dim ds As New DataSet
ds = GetDataSet("processes)If IsDatasetValid(ds) Thend.DataSource = dsd.DataBind()End IfCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionType_Init(ByVal sender As Object, ByVal e As EventArgs)Dim d As DropDownList = DirectCast(sender, DropDownList)Dim ds As New DataSet
TryTryds = GetDataSet("actiontypelist")If IsDatasetValid(ds) Thend.DataSource = dsd.DataBind()End IfCatch ex As ExceptionEnd TryCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionStatus_Init(ByVal sender As Object, ByVal e As EventArgs)Dim d As DropDownList = DirectCast(sender, DropDownList)Dim ds As New DataSet
TryTryds = GetDataSet("statuslist")If IsDatasetValid(ds) Thend.DataSource = dsd.DataBind()End IfCatch ex As ExceptionEnd TryCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionDueDate_Init(ByVal sender As Object, ByVal e As EventArgs)TryDim c As WebDateChooser = DirectCast(sender, WebDateChooser)c.Format = DateFormat.ShortCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionCompletionDate_Init(ByVal sender As Object, ByVal e As EventArgs)TryDim c As WebDateChooser = DirectCast(sender, WebDateChooser)c.Format = DateFormat.ShortCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igActionDate_Init(ByVal sender As Object, ByVal e As EventArgs)TryDim c As WebDateChooser = DirectCast(sender, WebDateChooser)c.Format = DateFormat.ShortCatch ex As ExceptionEnd TryEnd Sub
Protected Sub igAction_UpdateRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs)
End Sub
Yes, thanks. It would help if I could spell...lol. I had it spelled NullDataLabel and didn't notice it. The last item I need help with, is that I still can't get my Add Rows to work. It displays, but I have no idea how to template it or where to template it, or how to activate it. Can you help with this last item. Thanks soooooo much for you patience and help.
Do you mean that you want to use a similar template for the adding of a new row?
You’ll to use the RowEditTemplate for this as well. However you’ll have to use JS to manually open the template in the AfterRowInsertHandler.
Here’s an example:
var keepOpen=false;
function UltraWebGrid1_AfterRowInsertHandler(gridName, rowId, index) {
//Add code to handle your event here.
keepOpen=true;
var grid = igtbl_getGridById("UltraWebGrid1");
var row = grid.Rows.getRowById(rowId);
row.editRow();
}
// -->
function UltraWebGrid1_BeforeRowTemplateCloseHandler(gridName, rowId, bSaveChanges){
if(keepOpen)
{
keepOpen=false;
return true;
I use the keepOpen global variable so that I can cancel the closing of the template since it’ll try to close the template right after you manually open it for some reason.
Please refer to the attached sample and let me know if this is the behavior you’re after.
Maya, Thanks. I will look at this soon. I have a different problem that has shown up. I have two date fields in my grid, when I click to edit, the template has the first date in both date controls. When I stop through in the code behind where I set them, like in your example, the set correctly. But once it displays, both date controls have the date of the first control. One is named date and the other is completeddate, both controls have the date value. LIke I said, when i stop through, the dates are set appropriately, but somewhere my completeddate control is being over written with the date control value. My html & code are below. I though I must be referencing the wrong cell somehow, but it appears to be the correct cell. I'm mystified. Thanks.
<igtbl:UltraWebGrid ID="igGrid" runat="server" EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" DisplayLayout-CellPaddingDefault="5"> <Bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="ID" Key="ID" Hidden="true"> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="DATE" Key="DATE"> <Header Caption="Due Date"> <RowLayoutColumnInfo OriginX="2" /> </Header> <HeaderStyle HorizontalAlign="Center" /> <CellStyle HorizontalAlign="Center" /> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="NAME" Key="NAME"> <Header Caption="Name"> <RowLayoutColumnInfo OriginX="3" /> </Header> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left" /> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="Analysis" Key="Analysis"> <Header Caption="Analysis"> <RowLayoutColumnInfo OriginX="4" /> </Header> <HeaderStyle HorizontalAlign="Left" /> <CellStyle HorizontalAlign="Left" /> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="STATUS" Key="STATUS"> <Header Caption="Status"> <RowLayoutColumnInfo OriginX="5" /> </Header> <HeaderStyle HorizontalAlign="Center" /> <CellStyle HorizontalAlign="Center" /> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="GOALDESC" Key="GOALDESC"> <Header Caption="Goal"> <RowLayoutColumnInfo OriginX="6" /> </Header> <HeaderStyle HorizontalAlign="Center" /> <CellStyle HorizontalAlign="Center" /> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="COMPLETEDDATE" Key="COMPLETEDDATE"> <Header Caption="Completed"> <RowLayoutColumnInfo OriginX="7" /> </Header> <HeaderStyle HorizontalAlign="Center" /> <CellStyle HorizontalAlign="Center" /> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> <RowEditTemplate> <div id="divGridControls" style="background-color: #E5ECFD;"> <p align="left" style="padding: 2px 2px 2px 2px; border-color: Lightgray; border-width: 1px; border-style: solid;"> <asp:Table ID="tblGridControls" runat="server"> <asp:TableRow Visible="false"> <asp:TableCell ColumnSpan="2"> <asp:Label ID="lblGridID" runat="server" columnkey="ID"></asp:Label> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell Width="85px"> <asp:label ID="lblGridDueDate" runat="server">Due Date</asp:label> </asp:TableCell> <asp:TableCell> <igsch:WebDateChooser ID="igGridDueDate" columnkey="DATE" runat="server" EnableAppStyling="True" Section508Compliant="true" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" NullDateLabel="Select a Date" AllowNull="true" Format="Short"> </igsch:WebDateChooser> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblGridItem" runat="server">Name</asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtGridItem" runat="server" TextMode="MultiLine" Rows="3" MaxLength="10000" ToolTip="10,000 Maximum Characters" Width="850px" columnkey="NAME"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblGridAnalysis" runat="server">Analysis</asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtGridAnalysis" runat="server" TextMode="MultiLine" Rows="3" MaxLength="10000" ToolTip="10,000 Maximum Characters" Width="850px" columnkey="ANALYSIS"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblGridStatus" runat="server">Status</asp:Label> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="ddlGridStatus" runat="server" columnkey="STATUS" DataTextField="STATUS" Width="150px"> </asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblGridGoal" runat="server">Goal in AFS Plan</asp:Label> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="ddlGridGoal" runat="server" columnkey="GOALDESC" DataTextField="GOALDESC" Width="150px"> </asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblGridCompletedDate" runat="server">Completed</asp:Label> </asp:TableCell> <asp:TableCell> <igsch:WebDateChooser ID="igGridCompletedDate" columnkey="COMPLETEDDATE" runat="server" EnableAppStyling="True" Section508Compliant="true" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" NullDateLabel="Select a Date" AllowNull="true" Format="Short"> </igsch:WebDateChooser> </asp:TableCell> </asp:TableRow> </asp:Table> </p> <p align="center" style="background-color: #D5DDEA; vertical-align: middle; padding: 2px 2px 0px 2px; border-color: Gray; border-width: 1px; border-style: solid;"> <asp:ImageButton ID="ibtnGridOK" runat="server" ImageUrl="~/Images/oknew.png" OnClick="ibtnGridOK_Click" /> <asp:ImageButton ID="ibtnGridCancel" runat="server" ImageUrl="~/Images/cancelnew.png" /> </p> </div> </RowEditTemplate> <RowTemplateStyle Wrap="true"> </RowTemplateStyle> <AddNewRow View="Bottom" Visible="Yes"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout Name="igGrid" AllowDeleteDefault="Yes" AllowSortingDefault="No" AllowUpdateDefault="RowTemplateOnly" BorderCollapseDefault="Separate" CellPaddingDefault="5" AutoGenerateColumns="false" RowSelectorsDefault="Yes" RowHeightDefault="20px" NoDataMessage="No Performance Plan Items To Display" Version="4.00" CellClickActionDefault="Edit" SelectTypeRowDefault="Single" AllowAddNewDefault="Yes"> <FrameStyle> </FrameStyle> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> </DisplayLayout> </igtbl:UltraWebGrid>
Protected Sub igGrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles igGrid.InitializeLayout Try SetGridControls() Catch ex As Exception End Try With e.Layout.Bands(0).Columns.FromKey("DATE") .Header.Caption = "Due Date" .DataType = "System.DateTime" .Format = "MM/dd/yyyy" .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center End With With e.Layout.Bands(0).Columns.FromKey("NAME") .Header.Caption = "Performance Plan Goal" .Header.Style.HorizontalAlign = HorizontalAlign.Left .CellStyle.HorizontalAlign = HorizontalAlign.Left .CellStyle.Wrap = True .Width = Unit.Pixel(450) End With With e.Layout.Bands(0).Columns.FromKey("Analysis") .Header.Caption = "Analysis" .Header.Style.HorizontalAlign = HorizontalAlign.Left .CellStyle.HorizontalAlign = HorizontalAlign.Left .CellStyle.Wrap = True .Width = Unit.Pixel(650) End With With e.Layout.Bands(0).Columns.FromKey("COMPLETEDDATE") .Header.Caption = "Completed Date" .DataType = "System.DateTime" .Format = "MM/dd/yyyy" .Header.Style.HorizontalAlign = HorizontalAlign.Center .CellStyle.HorizontalAlign = HorizontalAlign.Center End With End Sub
Protected Sub igGrid_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles igGrid.InitializeRow Dim lGridID As Label = igGrid.Bands(0).RowEditItem.FindControl("lblGridID") Dim dtDueDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igGrid.Bands(0).RowEditItem.FindControl("igGridDueDate") Dim dtCompletedDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igGrid.Bands(0).RowEditItem.FindControl("igGridCompletedDate")
If Not IsNothing(lGridID) Then lGridID.Text = e.Row.Cells(0).Text End If If IsDate(e.Row.Cells(1).Text) = True Then If CDate(e.Row.Cells(1).Text) <= CDate("1/1/2000") Then e.Row.Cells(1).Text = " " dtDueDate.Value = "" Else dtDueDate.Value = CDate(e.Row.Cells(1).Text) End If Else dtDueDate.Value = " " End If If IsDate(e.Row.Cells(6).Text) = True Then If CDate(e.Row.Cells(6).Text) <= CDate("1/1/2000") Then e.Row.Cells(6).Text = " " dtCompletedDate.Value = "" Else dtCompletedDate.Value = CDate(e.Row.Cells(6).Text) End If Else dtCompletedDate.Value = " " End If
End Sub Private Sub SetGridControls() Dim Profile() As String = GetUserProfile(GetUser(Page.User.Identity.Name)) Dim officename As String = GetOfficeName(Profile) Dim ddlGridStatus As DropDownList = igGrid.Bands(0).RowEditItem.FindControl("ddlGridStatus") Dim ddlGridGoal As DropDownList = igGrid.Bands(0).RowEditItem.FindControl("ddlGridGoal") Dim ds As New DataSet Dim Choice As String = String.Empty
'Status List Try Choice = "statuslist" ds = GetDataSet(Choice) If IsDatasetValid(ds) Then ddlGridStatus.DataSource = ds ddlGridStatus.DataBind() End If Catch ex As Exception End Try 'goal List Try Choice = "perfgoallist" ds = GetDataSet(Choice) If IsDatasetValid(ds) Then ddlGridGoal.DataSource = ds ddlGridGoal.DataBind() End If Catch ex As Exception End Try End Sub
Do you mean the settings in the InitializeRow event that sets the value of the webdatechoosers? Keep in mind that the RowEditTemplate is only one instance for the whole grid and the current value for the controls get set trough JS on the client side. For this reason setting the Value of the WebDateChoosers in the InitializeRow event is actually not going to set the values per row. It would be better if you move this logic to the client side.
Let me know if you need further assistance with this.
Ok, thanks. Can you give me an example?
Thank you for sharing your approach.
I’m glad that you managed to resolved your issue.
Let me know if you have any further need of assistance with this issue.
Hi Maya. I have resolved the issue on my own. While this may not be the "best" way to do it, it is the only one so far that has worked for me. In the BeforeRowTemplateOpenHandler, just before I assign the cell's date value to the WebDateChooser, I manually format the UTC date by using a bit of free javascript from the following link rather than spending time building my own formatting function.(I don't know if it's okay to include an outside link or not).
http://blog.stevenlevithan.com/archives/date-time-format
So now my code is:
function igMyGrid_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) { var row = igtbl_getRowById(rowId); var currentValDueDate = row.getCell(1).getValue(); var currentValueCompletedDate = row.getCell(6).getValue(); currentValDueDate = dateFormat(currentValDueDate, "mm/dd/yyyy"); currentValueCompletedDate = dateFormat(currentValueCompletedDate, "mm/dd/yyyy"); dateChooserDueDate.value = currentValDueDate; dateChooserDueDate.inputBox.value = currentValDueDate; dateChooserCompletedDate.value = currentValueCompletedDate; dateChooserCompletedDate.inputBox.value = currentValueCompletedDate;}
function igMyGridDueDate_InitializeDateChooser(oDateChooser) { dateChooserDueDate = oDateChooser;}function igMyGridCompletedDate_InitializeDateChooser(oDateChooser) { dateChooserCompletedDate = oDateChooser;
This now makes the WebDateChooser display the initial date value as 02/01/2012, as I need it to to fulfill the requirements. Again, I'm still not sure what I have set or not set that was causing the previous methods to fail, but this overrides that and gives me the expected result I need.
Here is what I have in both HTML & code. How do I set the culture?
<igsch:WebDateChooser ID="igDueDate" runat="server" EnableAppStyling="True" Section508Compliant="true" StyleSetName="Office2007Blue" Format="Short" DisplayModeFormat="d" EditModeFormat="d" StyleSetPath="~/ig_res/" NullDateLabel="Select a Date"AllowNull="true" ClientSideEvents-InitializeDateChooser ="igDueDate_InitializeDateChooser"></igsch:WebDateChooser>
With e.Layout.Bands(0).Columns.FromKey("DATE").Header.Caption = "Due Date".DataType = "System.DateTime".Format = "MM/dd/yyyy".Header.Style.HorizontalAlign = HorizontalAlign.Center.CellStyle.HorizontalAlign = HorizontalAlign.Center.Width = Unit.Pixel(75)End With
Hello dbishop9 ,
Have you tried setting the ShortDatePattern with:
c.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
Where c is the current culture info.
Also you need to set for the Format prorty of the WebDateChooser to Short. For example:
<igsch:WebDateChooser ID="WebDateChooser1" columnkey="Data" runat="server" AllowNull="false" Format="Short" OnInit="WebDateChooser1_Init">
<ClientSideEvents InitializeDateChooser="WebDateChooser1_InitializeDateChooser">
</ClientSideEvents>
</igsch:WebDateChooser>
Hi Maya, That was the problem. I didn't know I had to actually initialize the clent-side events. I haven't had to do that for other controls. Thanks so much. I still can't get the display/text format to work. I've set the display format to "d" and it works after I've selected a date, but for the initial date it shows the Fri Sept 30 00:00:00 CDT 2011 format. I've set it in the control, in the code-behind on row initalize and control initialize, but nothing seems to work. I've even captured the value from the grid cell, formatting it, then assigned it to the control, but it still fails. This will keep me from using the grid, because the date has to initially display as mm/dd/yyyy. Any ideas?