復制代碼 代碼如下:
<!--Ajax實現頁面不閃爍,一直是Insus.NET所喜歡使用的-->
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div>
<!--放置一個TextBox,讓用戶輸入Data-->
<asp:TextBox runat="server"></asp:TextBox>
<!--放置一個LinkButton,提交數據-->
<asp:LinkButton runat="server" Text="Submit"></asp:LinkButton>
</div>
</ContentTemplate>
</asp:UpdatePanel>
復制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Insus.NET;
public partial class _Default : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e)
{
Data_Binding();
}
private void Data_Binding()
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
//這里寫提交到數據庫中
//下面是Demo使用
InsusJsUtility objJs = new InsusJsUtility();
if (string.IsNullOrEmpty(this.TextBox1.Text.Trim()))
{
objJs.JsAlert("沒有數據可提交。");
return;
}
objJs.JsAlert("數據已經提交:" + this.TextBox1.Text);
}
}
復制代碼 代碼如下:
this.TextBox1.Attributes.Add("onblur", "__doPostBack('LinkButton1','')");
新聞熱點
疑難解答