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
140
webdatechooser in webgrid-urgent plz help
posted

hi,

I have to use webdatechooser inside webgrid.I used the following code but still i wont get datechooser on editing .Plz help me

 

GridColumn = new UltraGridColumn();

GridColumn.BaseColumnName = "FromDate";

GridColumn.Header.Caption = GetResString("ValidFrom.Text"); //"From Date";

GridColumn.Header.RowLayoutColumnInfo.OriginY = 0;

GridColumn.Width = Unit.Percentage(25);

GridColumn.Key = "FromDate";

igrdAccess.Bands[0].Columns.Add(GridColumn);

GridColumn.AllowUpdate = AllowUpdate.Yes;

GridColumn.Type = ColumnType.Custom;

GridColumn.EditorControlID = fromDate.UniqueID;

fromDate.DropDownStyle.BackColor = System.Drawing.Color.Blue;

GridColumn.DataType = "System.DateTime";

fromDate.Format = Infragistics.WebUI.WebSchedule.DateFormat.Short;

GridColumn.FieldLen = 10;


GridColumn.HTMLEncodeContent = true;

 

Thanks in Advance,

Reagan.J

Parents
  • 28464
    posted

    This could very well be a page life-cycle problem - it really depends on where you execute this code. Please, use this code in the initialize event of the grid. Also, could you please try using fromData.ID instead of UniqueID?

    I just went through all these steps and it worked great for me. Here is my setup and code:

    protected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e)
        {
            UltraGridColumn GridColumn = new UltraGridColumn();
            GridColumn.BaseColumnName = "BirthDate";
            GridColumn.Header.Caption = "Date";
            GridColumn.Header.RowLayoutColumnInfo.OriginY = 0;
            GridColumn.Width = Unit.Percentage(25);
            GridColumn.Key = "BirthDate";
            UltraWebGrid1.Bands[0].Columns.Add(GridColumn);
            GridColumn.AllowUpdate = AllowUpdate.Yes;
            GridColumn.Type = ColumnType.Custom;
            GridColumn.FieldLen = 10;
            GridColumn.HTMLEncodeContent = true;       
            GridColumn.DataType = "System.DateTime";

            GridColumn.EditorControlID = WebDateChooser1.ID;
            WebDateChooser1.DropDownStyle.BackColor = System.Drawing.Color.Blue;       
            WebDateChooser1.Format = Infragistics.WebUI.WebSchedule.DateFormat.Short;       
        }

     

    <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"
            DataSourceID="AccessDataSource1" Height="200px" Width="325px"        
            oninitializelayout="UltraWebGrid1_InitializeLayout">
            <Bands>
                <igtbl:UltraGridBand>
                    <Columns>
                        <igtbl:UltraGridColumn BaseColumnName="FirstName" IsBound="True"
                            Key="FirstName">
                            <Header Caption="FirstName">
                            </Header>
                        </igtbl:UltraGridColumn>
                        <igtbl:UltraGridColumn BaseColumnName="LastName" IsBound="True" Key="LastName">
                            <Header Caption="LastName">
                                <RowLayoutColumnInfo OriginX="1" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="1" />
                            </Footer>                       
                        </igtbl:UltraGridColumn>
                        <igtbl:UltraGridColumn BaseColumnName="EmployeeID" DataType="System.Int32"
                            IsBound="True" Key="EmployeeID">
                            <Header Caption="EmployeeID">
                                <RowLayoutColumnInfo OriginX="2" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="2" />
                            </Footer>
                        </igtbl:UltraGridColumn>
                    </Columns>
                    <AddNewRow View="NotSet" Visible="NotSet">
                    </AddNewRow>
                </igtbl:UltraGridBand>
            </Bands>
            <DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1"  AllowUpdateDefault="RowTemplateOnly"
                RowHeightDefault="20px" Version="4.00">           
                <FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
                    Font-Size="8pt" Height="200px" Width="325px">
                </FrameStyle>
                <Pager>
                    <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                    <BorderDetails ColorLeft="White" ColorTop="White" />
                    </PagerStyle>
                </Pager>
                <EditCellStyleDefault BorderStyle="None" BorderWidth="0px">
                </EditCellStyleDefault>
                <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid">
                    <BorderDetails ColorLeft="White" ColorTop="White" />
                </HeaderStyleDefault>
                <RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid"
                    BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt">
                    <Padding Left="3px" />
                    <BorderDetails ColorLeft="White" ColorTop="White" />
                </RowStyleDefault>
                <AddNewBox>
                    <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                        <BorderDetails ColorLeft="White" ColorTop="White" />
                    </BoxStyle>
                </AddNewBox>
                <ActivationObject BorderColor="" BorderWidth="">
                </ActivationObject>
            </DisplayLayout>
        </igtbl:UltraWebGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server"
            DataFile="~/App_Data/Nwind.mdb"        
            SelectCommand="SELECT [FirstName], [LastName], [EmployeeID], [BirthDate] FROM [Employees]">
        </asp:AccessDataSource>
        <igsch:WebDateChooser ID="WebDateChooser1" runat="server">
        </igsch:WebDateChooser>

Reply Children