I have a WebDatechooser in an UltraWebGrid, inside an update panel on a content page for a master page. My controls are Infragistics 3.5 v10.3. My problem is that when I click on the Month or Year dropdowns, it closes the RowEditTemplate. I am initializing this in javascript. What do I need to do to stop this? Thanks.
<igsch:WebDateChooser ID="igDueDate" runat="server" EnableAppStyling="True" Section508Compliant="true" DisplayModeFormat="d" EditModeFormat="d" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/" NullDateLabel="Select a Date" ClientSideEvents-InitializeDateChooser="igDueDate_InitializeDateChooser" Format="Short" AllowNull="true" ></igsch:WebDateChooser>
Hello dbishop9 ,
I’ve managed to reproduce this issue.
Please refer to the following forum thread:
http://forums.infragistics.com/forums/p/17512/66259.aspx#66259
I’ve tested the solution provided there by Vince McDonald and have confirmed that it resolves this issue.
Let me know if you have any further questions regarding this.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hi Maya. I have applied his example, but it is for an actual dropdown control, not the dropdown inside the webdatechooser. Below is what I have, but of course I get an object expected error because the webdatechooser is not a dropdown/combo control and I'm not sure how to address it. Thanks.
function igMyGrid_BeforeRowTemplateCloseHandler(gridName, rowId, bSaveChanges) { var grid = igtbl_getGridById(gridName); var combo = igcmbo_getComboById("<%= igMyGridDueDate.ClientID %>"); var localEvent = (typeof (event) != 'undefined') ? event : grid.event; var localSrcElem = localEvent.srcElement ? localEvent.srcElement : localEvent.target;
if (localEvent && localSrcElem && igtbl_contains(combo.container, localSrcElem)) return true;}
Maya, have you gotten chance to look at this(see previous comment)? Please help! Thanks so much.
Hi Maya. Please Help!!! I'm including the code and javascript. For some reason, my WebDateChoosers are once again getting the date from the last row of my UltraWebGrid when I edit/save, not the current edit row. I've stepped through the code and the javascript portion sets it correctly before the template opens. When I edit text or something besides the webdate chooser and save, it doesn't keep that set value of the webdate chooser, it picks up the date of the last row in the grid. I'm not sure what I muffed up, but would you take a look and see what it is? Here is a scenario
Due Date Description Status Analysis Completed Date--------- ---------------------- -------- ------------------- --------------8/30/2011 Some text in a textbox Open Some more text here 4/15/20103/15/2012 Some text in a textbox Open Some more text here 2/5/20113/25/2012 Some text in a textbox Open Some more text here 1/12/2011
If I edit row 1, change the description and maybe the Status and save, it doesn't save the dates as 8/30/2011 & 4/15/2010, it saves row 3 dates 3/25/2012 & 1/12/2011. This is on a content page of a masterpage. The grid is inside an ajax updatepanel.
function igMyGrid_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) { var row = igtbl_getRowById(rowId); var currentValueDueDate = row.getCell(1).getValue(); var currentValueCompletedDate = row.getCell(6).getValue(); var dueDate = new Date(); var completedDate = new Date; var compareDate = new Date; compareDate = dateFormat("1/1/2000", "mm/dd/yyyy"); dueDate = dateFormat(currentValueDueDate, "mm/dd/yyyy"); completedDate = dateFormat(currentValueCompletedDate, "mm/dd/yyyy"); currentValueDueDate = dateFormat(currentValueDueDate, "mm/dd/yyyy"); currentValueCompletedDate = dateFormat(currentValueCompletedDate, "mm/dd/yyyy"); if (dueDate > compareDate) { dateChooserMyGridDueDate.value = currentValueDueDate; dateChooserMyGridDueDate.inputBox.value = currentValueDueDate; } else { dateChooserMyGridDueDate.value = Date(); dateChooserMyGridDueDate.inputBox.value = "Select a Date"; } if (completedDate > compareDate) { dateChooserMyGridCompletedDate.value = currentValueCompletedDate; dateChooserMyGridCompletedDate.inputBox.value = currentValueCompletedDate; } else { dateChooserMyGridCompletedDate.value = Date(); dateChooserMyGridCompletedDate.inputBox.value = "Select a Date"; }}function igMyGrid_BeforeRowTemplateCloseHandler(gridName, rowId, bSaveChanges) { var grid = igtbl_getGridById(gridName); var combo1 = dateChooserMyGridDueDate; var combo2 = dateChooserMyGridCompletedDate; var localEvent = (typeof (event) != "undefined") ? event : grid.event; var localSrcElem = localEvent.srcElement ? localEvent.srcElement : localEvent.target; if (localEvent && localSrcElem && igtbl_contains(combo1.container, localSrcElem)) { return true; } if (localEvent && localSrcElem && igtbl_contains(combo2.container, localSrcElem)) { return true; }}function igMyGridDueDate_InitializeDateChooser(oDateChooser) { dateChooserMyGridDueDate = oDateChooser;}function igMyGridCompletedDate_InitializeDateChooser(oDateChooser) { dateChooserMyGridCompletedDate = oDateChooser;
}
<igtbl:UltraWebGrid ID="igMyGrid" 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="Performance Plan Goal"> <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="Plan 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 in AFS Plan"> <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="divMyGridControls" 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="tblMyGridControls" runat="server"> <asp:TableRow Visible="true"> <asp:TableCell> <asp:Label ID="lblMyGridID" runat="server" columnkey="ID"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMyGridID" runat="server" Enabled="false" ToolTip="ID" columnkey="ID" BorderStyle="none" BackColor="#E5ECFD" ForeColor="#E5ECFD" Font-Size="0"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblMyGridItem" runat="server">Performance Plan Goal</asp:Label> </asp:TableCell> <asp:TableCell> <button id="btnMyGridGoal" runat="server" style="font-size: 8pt; width: 80px; cursor: pointer;" tabindex="3" type="button"> Check Spelling</button><br /> <asp:TextBox ID="txtMyGridItem" 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 Width="85px"> <asp:label ID="lblMyGridDueDate" runat="server">Due Date</asp:label> </asp:TableCell> <asp:TableCell> <igsch:WebDateChooser ID="igMyGridDueDate" runat="server" CalendarLayout-Culture="en-US" EnableAppStyling="True" Section508Compliant="true" StyleSetName="Office2007Blue" Format="Short" StyleSetPath="~/ig_res/" AllowNull="true" NullDateLabel="Select a Date" NullValueRepresentation="DBNull" ClientSideEvents-InitializeDateChooser ="igMyGridDueDate_InitializeDateChooser"> </igsch:WebDateChooser> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblMyGridAnalysis" runat="server">Analysis</asp:Label> </asp:TableCell> <asp:TableCell> <button id="btnMyGridAnalysis" runat="server" style="font-size: 8pt; width: 80px; cursor: pointer;" tabindex="3" type="button"> Check Spelling</button><br /> <asp:TextBox ID="txtMyGridAnalysis" 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="lblMyGridStatus" runat="server">Status</asp:Label> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="ddlMyGridStatus" runat="server" columnkey="STATUS" DataTextField="STATUS" Width="150px"> </asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblMyGridGoal" runat="server">Goal in AFS Plan</asp:Label> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="ddlMyGridGoal" runat="server" columnkey="GOALDESC" DataTextField="GOALDESC" Width="150px"> </asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblMyGridCompletedDate" runat="server">Completed</asp:Label> </asp:TableCell> <asp:TableCell> <igsch:WebDateChooser ID="igMyGridCompletedDate" runat="server" EnableAppStyling="True" Section508Compliant="true" StyleSetName="Office2007Blue" DisplayModeFormat="d" EditModeFormat="d" StyleSetPath="~/ig_res/" NullDateLabel="Select a Date" AllowNull="true" ClientSideEvents-InitializeDateChooser="igMyGridCompletedDate_InitializeDateChooser"> </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="ibtnMyGridOK" runat="server" ImageUrl="~/Images/oknew.png" OnClick="ibtnMyGridOK_Click" /> <asp:ImageButton ID="ibtnMyGridCancel" runat="server" ImageUrl="~/Images/cancelnew.png" /> </p> </div> </RowEditTemplate> <RowTemplateStyle Wrap="true" > </RowTemplateStyle> <AddNewRow View="Bottom" Visible="Yes"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout Name="igMyGrid" AllowDeleteDefault="Yes" AllowSortingDefault="Yes" AllowUpdateDefault="RowTemplateOnly" BorderCollapseDefault="Separate" CellPaddingDefault="5" AutoGenerateColumns="false" HeaderClickActionDefault="SortSingle" RowSelectorsDefault="Yes" RowHeightDefault="20px" NoDataMessage="No Performance Plan Items To Display" HeaderStyleDefault-Cursor="Hand" Version="4.00" CellClickActionDefault="Edit" SelectTypeRowDefault="Single" AllowAddNewDefault="No" > <ClientSideEvents BeforeRowTemplateOpenHandler="igMyGrid_BeforeRowTemplateOpenHandler" BeforeRowTemplateCloseHandler="igMyGrid_BeforeRowTemplateCloseHandler" /> <FrameStyle> </FrameStyle> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> </DisplayLayout> </igtbl:UltraWebGrid>
#Region "igMyGrid Plan Grid Methods"
Protected Sub igMyGrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles igMyGrid.InitializeLayout Try SetMyGridControls() 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 .Width = Unit.Pixel(75) End With With e.Layout.Bands(0).Columns.FromKey("NAME") .Header.Caption = "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 igMyGrid_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles igMyGrid.InitializeRow Dim dtDueDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igMyGrid.Bands(0).RowEditItem.FindControl("igMyGridDueDate") Dim dtCompletedDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igMyGrid.Bands(0).RowEditItem.FindControl("igMyGridCompletedDate")
Try If Not IsNothing(e.Row.Cells(1)) Then If IsDate(e.Row.Cells(1).Text) = True Then dtDueDate.Value = CDate(e.Row.Cells(1).Text) If CDate(e.Row.Cells(1).Text) <= CDate("1/1/2000") Then e.Row.Cells(1).Text = " " dtDueDate.Value = "" End If Else dtDueDate.Value = " " End If End If Catch ex As Exception End Try Try If Not IsNothing(e.Row.Cells(6)) Then If IsDate(e.Row.Cells(6).Text) = True Then dtCompletedDate.Value = CDate(e.Row.Cells(6).Text) If CDate(e.Row.Cells(6).Text) <= CDate("1/1/2000") Then e.Row.Cells(6).Text = " " dtCompletedDate.Value = "" End If Else dtCompletedDate.Value = " " End If End If Catch ex As Exception End Try
End Sub
''' <summary> ''' Set sort column and direction for report display of data ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> ''' <remarks></remarks> Protected Sub igMyGrid_SortColumn(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.SortColumnEventArgs) Handles igMyGrid.SortColumn Dim Profile() As String = GetUserProfile(GetUser(Page.User.Identity.Name)) Dim choice As String = "MyGrid" Dim igColumn As New Infragistics.WebUI.UltraWebGrid.UltraGridColumn
'set default if error, report sort will still work MyGridSortColumn = "due date" MyGridSortType = "ascending"
Try MyGridSortColumn = igMyGrid.Bands(0).Columns(e.ColumnNo).ToString()
Select Case igMyGrid.Bands(0).Columns(e.ColumnNo).SortIndicator Case 1 MyGridSortType = "ascending" Case 2 MyGridSortType = "descending" End Select Catch ex As Exception End Try End Sub
Protected Sub ibtnMyGridOK_Click() CheckEditItems() End Sub
Private Sub CheckMyGridItem() Dim Profile() As String = GetUserProfile(GetUser(Page.User.Identity.Name)) Dim tMyGridID As TextBox = igMyGrid.Bands(0).RowEditItem.FindControl("txtMyGridID") Dim dStatus As DropDownList = igMyGrid.Bands(0).RowEditItem.FindControl("ddlMyGridStatus") Dim dGoal As DropDownList = igMyGrid.Bands(0).RowEditItem.FindControl("ddlMyGridGoal") Dim tMyGridItem As TextBox = igMyGrid.Bands(0).RowEditItem.FindControl("txtMyGridItem") Dim tAnalysis As TextBox = igMyGrid.Bands(0).RowEditItem.FindControl("txtMyGridAnalysis") Dim dtDueDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igMyGrid.Bands(0).RowEditItem.FindControl("igMyGridDueDate") Dim dtCompletedDate As Infragistics.WebUI.WebSchedule.WebDateChooser = igMyGrid.Bands(0).RowEditItem.FindControl("igMyGridCompletedDate") Dim aPlanItem(6) As String Dim pos As Int64 = 0
'0=ID, 1=Date, 2=Name(10000), 3=Analysis(10000), 4=StatusID, 5=GoalID, 6=CompletedDate
aPlanItem(0) = tMyGridID.Text.Trim If Not IsNothing(dtDueDate.Value) Then aPlanItem(1) = dtDueDate.Value.ToString.Trim aPlanItem(1) = aPlanItem(1).ToString.Replace("12:00:00 PM", "00:00:00.000") aPlanItem(1) = aPlanItem(1).ToString.Replace("12:00:00 AM", "00:00:00.000") Else aPlanItem(1) = "1/1/1901" End If aPlanItem(2) = CleanSQL(tMyGridItem.Text.Trim) aPlanItem(3) = CleanSQL(tAnalysis.Text.Trim) If Not IsNothing(dStatus) Then aPlanItem(4) = GetID("status", dStatus.SelectedItem.Text.Trim()) End If If Not IsNothing(dGoal) Then aPlanItem(5) = GetID("goal", dGoal.SelectedItem.Text.Trim) End If If Not IsNothing(dtCompletedDate.Value) Then aPlanItem(6) = dtCompletedDate.Value.ToString.Trim If IsDate(aPlanItem(6)) Then pos = InStr(aPlanItem(6).Trim, " ") aPlanItem(6) = aPlanItem(6).Substring(0, pos - 1) 'aPlanItem(6) = aPlanItem(6).ToString.Replace("12:00:00 PM", "") 'aPlanItem(6) = aPlanItem(6).ToString.Replace("12:00:00 AM", "") End If Else aPlanItem(6) = "1/1/1901" End If 'saves to last id in grid UpdateMyGridItem(aPlanItem, Profile) LoadData()
#End Region
Hi Maya, I got this to work. I was getting an object required error using
var combo = igcombo_getComboById("<%=igMyGridDueDate.ClientID %>");
But since we have already intialized the WebDateChooser globally in previous examples, I changed it to
var combo = dateChooserMyGridDueDate;
and it worked as expected. Thanks so much Maya, you are a great resource and you are greatly appreciated!!!
It enough to get a reference to the date chooser . You can for example handle its initialize event and from there take the reference to the sender and put it in a global variable. Then just access it when needed.
I’m attaching the sample for your reference. Let me know if you have any questions related to it.