62,041
社区成员
发帖
与我相关
我的任务
分享
int rst = workSummary.Insert(strWPerson, strWContent, strWDate, strWProcess, strWRemark);
if (rst > 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "alert('成功!');", true);
}
$("#form1").validate({
submitHandler: function (form) {
$(form).ajaxSubmit();
} });
$("#submit").click(function () {
$("#form1").submit();
});
这些是表单元素。
<div id="addnew">
<div id="leanModalCt">
<div class="leanModalHeader">
<span>添加新记录</span>
</div>
<div class="txt-fld">
<table>
<tr>
<td>记录人<br /><asp:DropDownList ID="ddlWPerson" name="pWPerson" runat="server"></asp:DropDownList></td>
<td>工作时间<br /><input id="wdate" name="pwdate" onclick="WdatePicker()" type="text" /></td>
<td>工作进度<br /><input id="wprocess" name="pwprocess" class="required" type="text" /></td>
</tr>
</table>
</div>
<div class="txt-fld">
<label for="">工作内容</label>
<textarea id="wcontent" name="pwcontent" class="required" rows="1" cols="1"></textarea>
</div>
<div class="txt-fld">
<label for="">备注</label>
<textarea id="wremark" name="pwremark" rows="1" cols="1"></textarea>
</div>
<div class="btn-fld">
<input id="submit" type="button" value="提交 »"/>
</div>
</div>
注释掉的三条语句都执行了,但都看不到效果。
if (IsPostBack)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "alert('成功!');", true);
string strWPerson = ddlWPerson.Text;
string strWDate = Request.Form["pwdate"] == null ? "" : Request.Form["pwdate"];
string strWProcess = Request.Form["pwprocess"] == null ? "" : Request.Form["pwprocess"];
string strWContent = Request.Form["pwcontent"] == null ? "" : Request.Form["pwcontent"];
string strWRemark = Request.Form["pwremark"] == null ? "" : Request.Form["pwremark"];
int rst = workSummary.Insert(strWPerson, strWContent, strWDate, strWProcess, strWRemark);
if (rst > 0)
{
//Response.Redirect("wSummary.aspx");
// Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "alert('成功!');", true);
// Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript", "alert('成功!')", true);
// ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myscript", "alert('aasas')", true);
}
}