sfsz_mod.aspx
来自「ASP.NET开发实战详解」· ASPX 代码 · 共 169 行
ASPX
169 行
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.sqlclient" %>
<script runat="server">
dim Cnn as sqlconnection
dim cmd as sqlcommand
shared str3 as string
Sub Page_Load(Sender As Object, E As EventArgs)
dim sql as string
dim typestr as string
dim zjtypestr as string
str3="<script language='javascript'>window.close()<"
str3+="/"
str3+="script>"
if Not IsPostBack then
dim theid as string=trim(request.querystring("id"))
dim datar as sqldatareader
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
cnn.open()
sql="select * from cw_sf_other_set where id=" & theid
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
sfitem.text=Iif(IsDbNull(datar("sfitem")),"",datar("sfitem"))
sfprice.text=Iif(IsDbNull(datar("sfprice")),"",datar("sfprice"))
sfterm.text=Iif(IsDbNull(datar("sfterm")),"",datar("sfterm"))
memo.text=iif(isdbnull(datar("memo")),"",datar("memo"))
sfunit.selectedindex=iif(isdbnull(datar("sfunit")),"0",datar("sfunit"))
sfstart.selectedindex=iif(isdbnull(datar("sfstart")),"0",datar("sfstart"))
if trim(datar("sfstartdes"))="指定日期" then
sfstartdate.enabled="true"
sfstartdate.text=iif(isdbnull(datar("sfstartdate")),"",datar("sfstartdate"))
else
sfstartdate.enabled="false"
sfstartdate.text=""
end if
if datar("ysorno")="1" then
checkbox1.checked="true"
else
checkbox1.checked="false"
end if
Else
page.registerstartupscript("",getalertinfo("该收费项目不存在,可能已被删除!"))
Page.RegisterStartupScript("StartUp",str3)
End if
datar.close()
End if
End Sub
Sub ChangeSF(sender As Object, e As EventArgs)
if sfstart.selecteditem.text="指定日期" then
sfstartdate.enabled="true"
else
sfstartdate.enabled="false"
end if
End Sub
Sub Save_Click(Sender As Object, E As EventArgs)
dim theid as string=trim(request.querystring("id"))
dim sfitemstr as string=sfitem.text
dim sfpricestr as string=sfprice.text
dim sfunitstr as string=sfunit.selecteditem.value
dim sfdescriptstr as string=sfunit.selecteditem.text
dim sftermstr as string=sfterm.text
dim sfstartstr as string=sfstart.selecteditem.value
dim sfstartdesstr as string=sfstart.selecteditem.text
dim sfstartdatestr as string=sfstartdate.text
dim yesornostr as string
dim memostr as string=memo.text
dim sql as string
if checkbox1.checked then
yesornostr="1"
else
yesornostr="0"
end if
if sfstartdesstr<>"指定日期" then
sfstartdatestr="null"
else
sfstartdatestr="'" & sfstartdatestr & "'"
end if
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
cnn.open()
sql="update cw_sf_other_set set sfitem='" & sfitemstr & "',sfprice=" & sfpricestr & ",sfunit=" & sfunitstr & ",sfdescript='" & sfdescriptstr & "',sfterm=" & sftermstr & ",sfstart=" & sfstartstr & ",sfstartdes='" & sfstartdesstr & "',sfstartdate=" & sfstartdatestr & ",ysorno='" & yesornostr & "',memo='" & memostr & "' where id=" & theid
cmd=new sqlcommand(sql,cnn)
cmd.executenonquery
cnn.close
Page.RegisterStartupScript("",str3)
End Sub
Function GetAlertInfo(byval str1 as string) as String
dim Str2 as String
str2="<script language='javascript'>alert('" & str1 & "')<"
str2+="/"
str2+="script>"
return trim(str2)
End Function
</script>
<html>
<head>
<title>收费项目信息修改</title>
<base target="_self" />
</head>
<body background="../images/2.jpg">
<form runat="server">
<br><p align="center"><font style="color:blue" face="隶书" size="6"><strong>收费项目信息修改</strong></font></p>
<font style="color:blue">当前收费项目ID:</font><font style="color:red"><%=request.querystring("id")%></font>
<hr>
<table id="search" cellspacing="1" cellpadding="0" width="90%" align="center" border="0">
<tbody>
<tr class="tr4">
<td height="50" width="34%">
收费项目
<asp:TextBox class="input_text" id="sfitem" runat="server" width="110"></asp:TextBox>
</td>
<td width="33%">
收费价格
<asp:TextBox class="input_text" id="sfprice" runat="server" width="100"></asp:TextBox>
</td>
<td>
收费单位
<asp:DropDownList class="input_text" id="sfunit" runat="server" width="120">
<asp:ListItem Value="0" selected="true">户</asp:ListItem>
<asp:ListItem Value="1">平方米(按建筑面积)</asp:ListItem>
<asp:ListItem Value="2">平方米(按使用面积)</asp:ListItem>
<asp:ListItem Value="3">平方米(按收费面积)</asp:ListItem>
<asp:ListItem Value="4">平方米(按附加面积)</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr class="tr4">
<td height="50">
收费周期(月)
<asp:TextBox class="input_text" id="sfterm" runat="server" width="80"></asp:TextBox>
</td>
<td colspan=2>
收费开始日期
<asp:DropDownList class="input_text" id="sfstart" runat="server" width="140" OnSelectedIndexChanged="ChangeSF" autopostback="true">
<asp:ListItem Value="0" selected="true">业主收房日期</asp:ListItem>
<asp:ListItem Value="1">户主入住日期</asp:ListItem>
<asp:ListItem Value="2">指定日期</asp:ListItem>
</asp:DropDownList>
<asp:TextBox class="input_text" id="sfstartdate" enabled="false" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td height="50">
<asp:CheckBox id="CheckBox1" runat="server" Text="是否预收"></asp:CheckBox>
</td>
<td colspan=2>
备 注
<asp:TextBox class="input_text" id="memo" runat="server" width="330"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td valign="bottom" align="middle" colspan="3" height="120">
<asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保 存"></asp:button>
<br />
<asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ErrorMessage="*" ControlToValidate="sfitem">收费项目不可为空</asp:RequiredFieldValidator><br>
<asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ErrorMessage="*" ControlToValidate="sfprice">收费价格不可为空</asp:RequiredFieldValidator>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?