经过一些验证并设置超时后,DevExpress成功模式

时间:2017-02-06 05:31:57

标签: asp.net vb.net webforms devexpress

我这里有一个gridview,允许用户选择一行进行取消。 选择一行并提供其他字段后,我想创建一个验证 将检查是否所有字段都正确提供,同时检查我是否要显示"加载效果"一旦这个过程成功,那之后 我想在点击按钮后创建一个模态,表示"记录保存"并在几秒钟后消失,页面将重定向到相应的页面(例如:查看页面)。此外,我使用拆分器,以便我的主页面是我的索引页面,其他页面将从我的索引导航栏加载,并将显示在我的页面的中心部分。

这是我到目前为止所拥有的。

<dx:ASPxFormLayout ID="ASPxFormLayout3" runat="server" Theme="" >
    <Items>
    <dx:LayoutItem ShowCaption="False" HorizontalAlign="Right" Width="100%"> 
    <LayoutItemNestedControlCollection>
    <dx:LayoutItemNestedControlContainer ID="LayoutItemNestedControlContainer2" runat="server" >
    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" ProcessSelectionChangedOnServer="true" EnableTheming="True" Theme="Material" DataSourceID = "grid" KeyFieldName = "cancel_no" Width="100%" >
<SettingsBehavior ProcessSelectionChangedOnServer="True" />
<SettingsCommandButton>
</SettingsCommandButton>

<Columns>
<dx:GridViewCommandColumn ShowSelectCheckbox="true" Width="60px" Caption="Cancel" VisibleIndex="0"></dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn FieldName="No" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1" Visible = "false">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="RefNo" ShowInCustomizationForm="True" VisibleIndex="2" Visible = "false">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Item" ShowInCustomizationForm="True" VisibleIndex="3">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
<CellStyle HorizontalAlign="Left" VerticalAlign="Middle">
</CellStyle>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Code" ShowInCustomizationForm="True" VisibleIndex="4" Visible = "false">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Type" ShowInCustomizationForm="True" VisibleIndex="5">
<SettingsHeaderFilter>
<DateRangePickerSettings EditFormatString="" />
</SettingsHeaderFilter>
<CellStyle HorizontalAlign="Left" VerticalAlign="Middle">
</CellStyle>
</dx:GridViewDataTextColumn>


<Settings VerticalScrollBarMode="Visible" VerticalScrollableHeight="250" />
<SettingsDataSecurity AllowInsert="False" AllowDelete="False" AllowEdit="False" />
</dx:ASPxGridView>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</Items>
</dx:ASPxFormLayout>

<dx:ASPxFormLayout ID="ASPxFormLayout5" runat="server" Theme="Mulberry">
<SettingsAdaptivity AdaptivityMode="SingleColumnWindowLimit" SwitchToSingleColumnAtWindowInnerWidth="800" />
<Items>
<dx:LayoutGroup Caption="Approvals" ColCount="3" SettingsItemCaptions-Location="Top" HorizontalAlign="Center" Width="100%">

<Items>

<dx:LayoutItem Caption = "Checked By">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxTextBox ID="ASPxTextBox5" runat="server"  Theme="Metropolis" Border-BorderStyle="NotSet" BorderLeft-BorderStyle="None" BorderRight-BorderStyle="None" BorderTop-BorderStyle="None" />
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</Items>

<SettingsItemCaptions Location="Top"></SettingsItemCaptions>
</dx:LayoutGroup>

</Items>
</dx:ASPxFormLayout>

<dx:ASPxFormLayout ID="ASPxFormLayout4" runat="server" >
<SettingsAdaptivity AdaptivityMode="SingleColumnWindowLimit" SwitchToSingleColumnAtWindowInnerWidth="800" />
<Items>
<dx:LayoutGroup ShowCaption="False" ColCount="1" SettingsItemCaptions-Location="Top" HorizontalAlign="Right" Width="100%">
<Items>
<dx:LayoutItem ShowCaption="False">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Submit" Theme="Material" />
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
<Border BorderStyle="None" />
</dx:LayoutItem>

<dx:LayoutItem ShowCaption="False">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxButton ID="ASPxButton2" runat="server" Text="Clear" Theme="Material"></dx:ASPxButton>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</Items>

<SettingsItemCaptions Location="Top"></SettingsItemCaptions>
</dx:LayoutGroup>
</Items>
</dx:ASPxFormLayout>

这是我的后端。我想创建一个验证,检查它是否有一个&#34; Checked复选框&#34;如果没有那么保存将不会继续或将弹出另一个模式将显示&#34;没有选中复选框&#34;类似的东西。

Protected Sub ASPxButton1_Click(sender As Object, e As System.EventArgs) Handles ASPxButton1.Click
        getIndeces()
        save_cancelitem()
        save_canceldetails()
End Sub                                    

Protected Sub save_cancelitem()
        Dim cn As New SqlConnection(ConfigurationManager.ConnectionStrings("prod").ConnectionString)
        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "save_tocancel"
        cmd.Connection = cn
        cn.Open()
        cmd.Parameters.AddWithValue("@cnc_hdrno", ASPxTextBox2.Text)
        cmd.Parameters.AddWithValue("@cnc_agen", ASPxComboBox1.Text)
        cmd.Parameters.AddWithValue("@cnc_adver", ASPxComboBox2.Text)
        cmd.Parameters.AddWithValue("@cnc_refno", ASPxComboBox3.Text)
        cmd.Parameters.AddWithValue("@cnc_teldate", "")
        cmd.Parameters.AddWithValue("@cnc_docno", ASPxComboBox3.Value)
        cmd.Parameters.AddWithValue("@cnc_reason", "")
        cmd.Parameters.AddWithValue("@cnc_authby", "")
        cmd.Parameters.AddWithValue("@cnc_client", "")
        cmd.Parameters.AddWithValue("@cnc_aprv", "")
        cmd.Parameters.AddWithValue("@cnc_SD", "")
        cmd.Parameters.AddWithValue("@cnc_recvby", "")
        cmd.ExecuteNonQuery()
        cn.Close()
    End Sub



Protected Sub save_canceldetails()
        Dim rkey As String = Session("rkey").ToString
        Dim cn As New SqlConnection(ConfigurationManager.ConnectionStrings("ofs").ConnectionString)
        Dim cmd As New SqlCommand("select Product, Version, Frequency, Length, Program, ordd_teledte, Billing_Cost, Internal_Cost, iscancelled from canceltbl where rkey = @rkey", cn)
        cmd.Parameters.AddWithValue("@rkey", rkey)
        Dim adp As New SqlDataAdapter
        adp.SelectCommand = cmd
        Dim dta As New DataTable
        adp.Fill(dta)
        Dim dt_hdrno As DataColumn = dta.Columns.Add("dt_hdrno", Type.GetType("System.String"))
        Dim dt_rkey As DataColumn = dta.Columns.Add("dt_rkey", Type.GetType("System.String"))
        For Each r As DataRow In dta.Rows
            r(dt_hdrno) = ASPxTextBox2.Text
            r(dt_rkey) = rkey
        Next
        Dim bulkdtl As SqlBulkCopy = New SqlBulkCopy(ConfigurationManager.ConnectionStrings("ofs").ConnectionString)
        bulkdtl.DestinationTableName = "cancel_dtl"
        bulkdtl.ColumnMappings.Add("Item", "item_cancel")
        bulkdtl.ColumnMappings.Add("Code", "item_code")
        bulkdtl.ColumnMappings.Add("Type", "item_type")

    End Sub

0 个答案:

没有答案