Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
WebDateChooser in UltraWebGrid not working in IE 9, Date Retrieved as Null in Firefox and Chrome
posted

Hi All,
I am using Infragistics Version=8.1.20081.1000. I have 3 columns in UltraWebGrid. In the first column UltraGrid column i have Date, in second Time and in Third Activity Hours. When Clicking Add New row button, new row gets added and the previous row selected date gets bound in the next Row Date column.
Clicking on Delete Row buttons delets selected row.
Basically i have two issues here:
1.The Code doesnt work in IE9.  Unable to add row and select Dates.
2.The script doesnt work fine in chrome and firefox. When clicked on the date column and on blur the date is set to min date and value is retrieved as null . Getting the null value when no date is selected in next row.
Please help me. This is an urgent issue. Tried all means but couldnt find exact solution.
Would be greatful i any one could answer as early as possible and give me the correct solution.
My Aspx Code :
-----------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InfragisticsTest.aspx.cs"
    Inherits="InfragisticsTest" %>

<%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %>
<%@ Register Assembly="Infragistics2.WebUI.WebDateChooser.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.WebSchedule" TagPrefix="igsch" %>
<%@ Register Assembly="Infragistics2.WebUI.WebDataInput.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml ">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td class="formlabel" valign="top">
                        <asp:Label ID="lblDate" runat="server" Text="Activity Date"></asp:Label><span style='color: Red'>*</span>
                    </td>
                    <td class="formlabel" valign="top">
                        :
                    </td>
                    <td valign="top">
                        <igtbl:UltraWebGrid ID="ugActivityDates" runat="server">
                            <DisplayLayout StationaryMargins="Header" AutoGenerateColumns="false" AllowSortingDefault="OnClient"
                                RowHeightDefault="20px" RowSizingDefault="Free" Version="3.00" SelectTypeRowDefault="Single"
                                SelectTypeCellDefault="Extended" HeaderClickActionDefault="SortSingle" BorderCollapseDefault="Separate"
                                AllowColSizingDefault="Free" Name="ugActivityDates" TableLayout="Fixed" AllowAddNewDefault="Yes"
                                AllowDeleteDefault="Yes" AllowUpdateDefault="Yes" CellSpacingDefault="3" CellClickActionDefault="Edit"
                                ScrollBarView="Both" ScrollBar="Auto" ColFootersVisibleDefault="No">
                                <HeaderStyleDefault CssClass="color1">
                                </HeaderStyleDefault>
                                <FrameStyle CssClass="gridFramestyle" Cursor="Default">
                                </FrameStyle>
                                <Pager AllowPaging="false">
                                </Pager>
                                <EditCellStyleDefault BorderWidth="0px" BorderStyle='None'>
                                </EditCellStyleDefault>
                                <RowAlternateStyleDefault CssClass="color8">
                                </RowAlternateStyleDefault>
                                <ClientSideEvents InitializeLayoutHandler="ugActivityDates_InitializeLayoutHandler"
                                    AfterRowActivateHandler="ugActivityDates_AfterRowActivate" />
                                <RowStyleDefault CssClass="color6">
                                </RowStyleDefault>
                                <FilterOptionsDefault AllowRowFiltering="OnServer">
                                    <FilterDropDownStyle Cursor="Hand">
                                    </FilterDropDownStyle>
                                </FilterOptionsDefault>
                                <AddNewBox View="Full">
                                </AddNewBox>
                            </DisplayLayout>
                            <Bands>
                                <igtbl:UltraGridBand BaseTableName="Table2" RowSelectors="No">
                                    <Columns>
                                        <igtbl:UltraGridColumn Key="Date" IsBound="True" BaseColumnName="Date" Type="Custom"
                                            DataType="System.DateTime" Width="120px" AllowUpdate="Yes" AllowRowFiltering="false"
                                            AllowNull="false" SortIndicator="Disabled">
                                            <Footer>
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Footer>
                                            <Header Caption="Date">
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Header>
                                            <CellStyle BorderColor="black" BackColor="white" BorderWidth="1px" BorderStyle='Solid'>
                                            </CellStyle>
                                        </igtbl:UltraGridColumn>
                                        <igtbl:UltraGridColumn Key="Time" IsBound="True" BaseColumnName="Time" Width="220px"
                                            AllowUpdate="Yes" AllowRowFiltering="false" AllowNull="false" SortIndicator="Disabled">
                                            <Footer>
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Footer>
                                            <Header Caption="Time (eg. 10.00am – 4.30pm)">
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Header>
                                            <CellStyle BorderColor="black" BackColor="white" BorderWidth="1px" BorderStyle='Solid'>
                                            </CellStyle>
                                        </igtbl:UltraGridColumn>
                                        <igtbl:UltraGridColumn Key="ActivityHours" IsBound="True" BaseColumnName="ActivityHours"
                                            Width="120px" AllowUpdate="Yes" AllowRowFiltering="false" AllowNull="false" SortIndicator="Disabled">
                                            <Footer>
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Footer>
                                            <Header Caption="Activity Hours">
                                                <RowLayoutColumnInfo OriginX="0" />
                                            </Header>
                                            <CellStyle BorderColor="black" BackColor="white" BorderWidth="1px" BorderStyle='Solid'>
                                            </CellStyle>
                                        </igtbl:UltraGridColumn>
                                    </Columns>
                                    <AddNewRow View="NotSet" Visible="NotSet">
                                    </AddNewRow>
                                    <FilterOptions AllString="">
                                        <FilterDropDownStyle BackColor="White">
                                        </FilterDropDownStyle>
                                    </FilterOptions>
                                </igtbl:UltraGridBand>
                            </Bands>
                        </igtbl:UltraWebGrid>
                        <igsch:WebDateChooser ID="wdcCheckIn" runat="server" Width="90px" AllowNull="false"
                            Height="19px" Font-Size="8pt" Font-Names="Verdana">
                            <EditStyle Width="90px">
                            </EditStyle>
                            <CalendarLayout ShowTitle="False">
                                <DayStyle Font-Size="X-Small"></DayStyle>
                                <FooterStyle Font-Size="X-Small" BackColor="WhiteSmoke">
                                    <Padding Bottom="3px" Left="3px" Top="3px" Right="3px"></Padding>
                                </FooterStyle>
                                <OtherMonthDayStyle ForeColor="#E0E0E0"></OtherMonthDayStyle>
                                <TodayDayStyle BackColor="White"></TodayDayStyle>
                                <DropDownStyle Font-Size="X-Small" Font-Names="Verdana" BackColor="WhiteSmoke">
                                </DropDownStyle>
                                <DayHeaderStyle Font-Size="X-Small" Font-Bold="True" BorderColor="White" BackColor="WhiteSmoke">
                                    <Padding Bottom="3px" Left="3px" Top="3px" Right="3px"></Padding>
                                </DayHeaderStyle>
                                <TitleStyle BorderWidth="1px" BorderStyle='Outset'></TitleStyle>
                            </CalendarLayout>
                            <DropDownStyle Width="200px" BackColor="White">
                            </DropDownStyle>
                            <ExpandEffects Type="Fade" Duration="500"></ExpandEffects>
                        </igsch:WebDateChooser>
                        <igtxt:WebNumericEdit ID="wneActivityHours" runat="server" Width="90px" Height="19px"
                            Font-Size="8pt" Font-Names="Verdana" MinDecimalPlaces="Two" MaxLength="5">
                        </igtxt:WebNumericEdit>
                        <input type="button" id="btnAdd" runat="server" value="Add New Row" onclick="return AddCheckIORow();" />
                        <input type="button" runat="server" id="btnDeleteRow" onclick="deleteGridRow();"
                            value="Remove Row" />
                    </td>
                </tr>
            </table>

            <script type="text/javascript" language="javascript">
 
 var gridDatesID;
function ugActivityDates_InitializeLayoutHandler(gridName)
{   
    gridDatesID=gridName;  
    igtbl_getGridById(gridName).Rows.getRow(0).getCell(0).beginEdit();
}
function AddCheckIORow()

     var rowIO = igtbl_addNew( gridDatesID, 0 );
     var grid = igtbl_getGridById(gridDatesID);
     var count = grid.Rows.length;
     rowIO.getCell(0).setValue("");
     grid.Rows.getRow(count-1).getCell(0).beginEdit();    
     return false;
}

    var hdnRow=0;  
    function ugActivityDates_AfterRowActivate(gridName, id)
    {      
          var row =igtbl_getActiveRow(gridName);        
          if(row!=null)
          {          
                hdnRow=row;          
          }         
          else
          {
                hdnRow=0;
          }
    }
    function deleteGridRow()
    {  
        if(hdnRow!=0)
        {
            var grid = igtbl_getGridById(gridDatesID);
            var count = grid.Rows.length;
            if(count>1)
            {
                if(hdnRow!=null)
                {
                   if(hdnRow.remove())
                   {
                       
                   }    
                   else
                   {
                        alert('Please select a row');
                   }          
                }
                else
                {
                    alert('Please select a row');
                }
            }
            else
            {
                alert('Atleast one Activity Date required');
            }
        }
        else
        {
              alert('Please select a row');
        }
    }
            </script>

        </div>
    </form>
</body>
</html>
My .Cs Code:
--------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class InfragisticsTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Globalization.CultureInfo cTo = new System.Globalization.CultureInfo("en-US");
        cTo.DateTimeFormat.ShortDatePattern = ConfigurationManager.AppSettings["DateFormat"].ToString();// "dd/MM/yyyy";
        wdcCheckIn.CalendarLayout.Culture = cTo;
        if (!IsPostBack)
        {
            bindDataNew();
        }
    }
    private void bindDataNew()
    {
        ugActivityDates.Rows.Clear();
        DataTable dt = new DataTable("Table2");
        dt.Columns.Add("Date");
        dt.Columns["Date"].DataType = typeof(System.DateTime);
        DataRow dr;
        dr = dt.NewRow();
        dr["Date"] = System.DateTime.Now.AddMonths(1).AddDays(1);
        dt.Rows.Add(dr);

        ugActivityDates.DataSource = dt;
        ugActivityDates.DataBind();

        ugActivityDates.Columns[0].EditorControlID = wdcCheckIn.UniqueID;
        ugActivityDates.Columns[0].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;
        ugActivityDates.Columns[0].AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;

        ugActivityDates.Columns[2].EditorControlID = wneActivityHours.UniqueID;
        ugActivityDates.Columns[2].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;
        ugActivityDates.Columns[2].AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;

        wdcCheckIn.MinDate = System.DateTime.Now.AddMonths(1);
        wdcCheckIn.Value = System.DateTime.Now.AddMonths(1).AddDays(1);


    }
}