Unable to Integrating WebInput in Webgrid for date time input is not working

4 replies. Last post: July 17, 2019 7:57 AM by Yatendra Sharma
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Fung InterMember

Hi,


I am trying to input date time in a WebGrid with a Masked WebInput as DateTime picker. But after I changed the date value, the cell become empty.

I don't know if had made wrong settings for the WebGrid/ WebInput, I have attached Code below and the way to reproduce the issue (png file) for your reference. Please kindly assist. Thanks

ASPX Code:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DateInGrid.aspx.vb" Inherits="IntersoftTeseting.DateInGrid" %>
<%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls"
    TagPrefix="ISWebInput" %>
<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="250px" UseDefaultStyle="true"
            Width="500px">
            <LayoutSettings AllowEdit="Yes">
            </LayoutSettings>
        </ISWebGrid:WebGrid>
        <ISWebInput:WebInput ID="WebInput1" runat="server">
            <HighLight IsEnabled="True" Type="Phrase" />
            <EditFormat Format="dd MMM yyyy" IsEnabled="true" Type="DateTime">
                <MaskInfo MaskExpression="00 LLL 0000">
                </MaskInfo>
            </EditFormat>
            <DisplayFormat>
                <ErrorWindowInfo IsEnabled="False">
                </ErrorWindowInfo>
            </DisplayFormat>
            <DateTimeEditor DateInputLink="" IsEnabled="True">
                <DropDownYearFrameStyle BackColor="#FFFFFF" BorderColor="Black" BorderStyle="Solid"
                    BorderWidth="1px">
                </DropDownYearFrameStyle>
                <DropDownMonthFrameStyle BackColor="#FFFFFF" BorderColor="Black" BorderStyle="Solid"
                    BorderWidth="1px">
                </DropDownMonthFrameStyle>
            </DateTimeEditor>
            <CultureInfo CultureName="en-US">
            </CultureInfo>
        </ISWebInput:WebInput>
    </div>
    </form>
</body>
</html>


VB Code:
Imports ISNet.WebUI.WebGrid
Public Class DateInGrid
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    Public Function GetDiffData() As DataTable
        Dim dt As New DataTable
        dt.Columns.Add("Str", GetType(String))
        dt.Columns.Add("Int", GetType(Integer))
        dt.Columns.Add("DateTime", GetType(Date))
        For i As Integer = 1 To 100
            dt.Rows.Add(i & "_" & i, i, Now.AddDays(i).Date)
        Next
        Return dt
    End Function
    Private Sub WebGrid1_InitializeDataSource(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Handles WebGrid1.InitializeDataSource
        e.DataSource = GetDiffData()
    End Sub
    Private Sub WebGrid1_PrepareDataBinding(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Handles WebGrid1.PrepareDataBinding
        Dim wg As WebGrid = sender
        If Not IsPostBack Then
            wg.RetrieveStructure()
        End If
        For Each wgcol As WebGridColumn In wg.RootTable.Columns
            Select Case wgcol.Name.ToLower
                Case "datetime"
                    wgcol.EditType = EditType.Custom
                    'wgcol.DataFormatString = "dd MMM yyyy"
                    wgcol.CustomEditorName = "WebInputNET"
                    wgcol.CustomEditorServerId = "WebInput1"
            End Select
        Next
    End Sub
End Class

  


Regards,

Fung

1 attachment
All times are GMT -5. The time now is 6:21 AM.
Previous Next