更新进度样本 [英] Update Progress Sample

查看:84
本文介绍了更新进度样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设计:


Design :


<asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <div>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
               <asp:Button ID="Button1" runat="server" OnClientClick="Change();" Text="Button" OnClick="Button1_Click" />
           </ContentTemplate>
       </asp:UpdatePanel>
       <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
           <ProgressTemplate>
               <asp:Label ID="Label1" runat="server" Text="Loading..." Style="top: 224px; left: 425px;
                   position: absolute; height: 24px; width: 73px" BackColor="#00FF99"></asp:Label>
           </ProgressTemplate>
       </asp:UpdateProgress>
   </div>




代码:




Code :

protected void Button1_Click(object sender, EventArgs e)
   {
       System.Threading.Thread.Sleep(5000);
   }

推荐答案

在TextBox事件中添加此代码...




受保护的void TextBox1_TextChanged(对象发送者,EventArgs e)
{
SqlConnection con =新的SqlConnection(@数据源= MAJ-056 \ SQLEXPRESS;初始目录=示例;集成安全性= True");
con.Open();
SqlCommand cmd =新的SqlCommand(从TABLENAME中选择*,其中TicketID =" + Convert.ToInt64(TextBox1.Text)+",con);
SqlDataReader dr = cmd.ExecuteReader();
如果(!dr.Read())
{
Response.Write("Invalid Ticket ID");
}
con.Close();
}
Add this code in TextBox event...




protected void TextBox1_TextChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=MAJ-056\SQLEXPRESS;Initial Catalog=Sample;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select * from TABLENAME where TicketID=" + Convert.ToInt64(TextBox1.Text) + "", con);
SqlDataReader dr = cmd.ExecuteReader();
if (!dr.Read())
{
Response.Write("Invalid Ticket Id");
}
con.Close();
}


这篇关于更新进度样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆