WebInput Unable to be in "Edit Mode" after WebGrid calling Refresh All

6 replies. Last post: February 21, 2013 4:14 AM by Bernard Xiang
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Fung InterMember

Hi,

To Reproduce the issue:

  1. A WebInput control for inputing Date Time (with Edit & display format and also mask exp.)
  2. Integrate the WebInput (from 1.) into WebGrid's columns
  3. Add A Button to Call WebGrid's Refresh All
  4. Run the Project
  5. Enter Edit mode for column with WebInput as input control
  6. Press the Refresh Button
  7. Try to Enter Edit mode for the same column again
  8. JavaScript Error
Message: Object required
Line: 7
Char: 24063
Code: 0
URI: http://localhost:4933/ISRes.axd?G/WebGrid_Edit.js/707200431

WebGrid's version: 7.0.7200.431

WebInput's version: 4.0.7200.29


Thanks and Regards,

Fung


Below is the Code for reproducing the error.

ASPX Code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="NewTest.WebForm1" %>
<%@ Register Assembly="NewTest" Namespace="NewTest" TagPrefix="cc1" %>
<%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls"
    TagPrefix="ISWebInput" %>
<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<html>
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function testRefresh() {
            var wg = ISGetObject("WebGrid1");
            wg.RefreshAll();
        }
    </script>
 </head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type="button" id="btn" onclick="testRefresh()" value="Refresh" />
                <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="500px" Width="500px" 
                    UseDefaultStyle="True" 
                    DefaultStyleMode="Standard">
                    <LayoutSettings AllowEdit="Yes" AllowBatchUpdate="True" AutoHeight="true"
                        AutoWidth="true" >
                        <BatchUpdateSettings AllowReviewChanges="True" />
                    </LayoutSettings>
                </ISWebGrid:WebGrid>
        <ISWebInput:WebInput ID="WebInput1" runat="server" style="margin-bottom: 0px">
            <HighLight IsEnabled="True" Type="Phrase"/>
            <EditFormat Format="dd MMM yyyy" IsEnabled="true" Type="DateTime" >
                <MaskInfo MaskExpression="00 LLL 0000">
                </MaskInfo>
            </EditFormat>
<DisplayFormat Format="dd MMM yyyy" IsEnabled="false" IsValidateOnChange="false">
    <ErrorWindowInfo IsEnabled="False">
    </ErrorWindowInfo>
</DisplayFormat>
            <DateTimeEditor DateInputLink="" IsEnabled="false">  
                <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>
        <ISWebInput:WebInput ID="WebInput2" runat="server">
            <HighLight IsEnabled="True" Type="Phrase" />
            <EditFormat Format="dd MMM yyyy" IsEnabled="true" Type="DateTime" IsValidateOnChange="false">
                <MaskInfo MaskExpression="00 LLL 0000">
                </MaskInfo>
            </EditFormat>
<DisplayFormat Format="dd MMM yyyy" IsEnabled="true" IsValidateOnChange="false">
    <ErrorWindowInfo IsEnabled="False">
    </ErrorWindowInfo>
</DisplayFormat>
            <DateTimeEditor DateInputLink="" IsEnabled="true" EditValueByEditorOnly="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 WebForm1
    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))
        dt.Columns.Add("strDate", GetType(String))
        dt.Columns.Add("DatePicker", GetType(Date))
        dt.Columns.Add("strDatePicker", GetType(String))
        For i As Integer = 1 To 100
            dt.Rows.Add(i & "_" & i, i, Now.AddDays(i).Date, Now.AddDays(i).ToString("dd MMM yyyy"), Now.AddDays(-i).Date, Now.AddDays(-i).Date.ToString("dd MMM yyyy"))
        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
        Me.WebInput2.UseDefaultStyle = True
        Dim wg As WebGrid = sender
        wg.RetrieveStructure()
        wg.RootTable.DataKeyField = "Str"
        For Each wgcol As WebGridColumn In wg.RootTable.Columns
            Select Case wgcol.Name.ToLower
                Case "datetime", "strdate"
                    wgcol.EditType = EditType.Custom
                    wgcol.DataFormatString = "dd MMM yyyy"
                    wgcol.CustomEditorName = "WebInputNET"
                    wgcol.CustomEditorServerId = "WebInput1"
                Case "datepicker", "strdatepicker"
                    wgcol.EditType = EditType.Custom
                    wgcol.DataFormatString = "dd MMM yyyy"
                    wgcol.CustomEditorName = "WebInputNET"
                    wgcol.CustomEditorServerId = "WebInput2"
            End Select
        Next
    End Sub
End Class


All times are GMT -5. The time now is 2:53 PM.
Previous Next