如何在客户端站点中执行页面. [英] how to execute a page in client site.

查看:59
本文介绍了如何在客户端站点中执行页面.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好先生
我有一个客户应用程序页面,其中有40多个数据进入数据库.但是,当我两次按保存按钮时,它将两次进入数据库.我也写了submit.Enable = False,但是由于网络缓慢,如果客户端单击两次,那么它将两次访问数据库.

有什么解决办法吗,当我单击按钮时,页面将暂停一段时间,直到数据将插入到数据库中.

请帮帮我.

谢谢.

Hello Sir
I have a Customer application Page which has more then 40 data going to database. But When I press two times to the save button , it is going twice to the database. I have written submit.Enable=False also but due to net slow if the client click twice then it is going twice to the database.

Is there any solution then when I click the button then the page will halt some time till data will insert to the database.

Please Help Me.

Thanks.

推荐答案

JBSahu,

为什么不使用进度栏,在这种情况下,您只需要在Button Click Event
上编写代码即可
Hi JBSahu,

Why Don''t you use the Progress Bar, I this case you only have to write code at Button Click Event
System.Threading.Thread.Sleep(5000);



此处的这段代码将帮助您的按钮停顿一会儿,直到值未保存在数据库中为止
但条件是不可见的,
为此,您需要使用请稍候的图像",这将显示客户端停止一会儿,您也可以增加时间5000是括号中的时间,并且记住它应该以千为单位,至少您可以给1000 Don; t比它少.

如果您想使用图像显示此内容,请使用更新面板"和更新进度"

在更新中声明图像并在更新面板中调用进度ID,也可以使CSS固定图像的大小.

结合使用适当的验证"可以停止客户端面临的上述问题,在验证"属性中使用Validation group.

例如:-

<asp:button id="btSubmit" runat="Server" text="Submit" validationgroup="Submit" />

<asp:requiredfieldvalidator id="RFV_btn" runat="Server" validationgroup="Submit" controltovalidate="yourfieldId" setfocusonerror="True" errormessage="Fill Entries First" ></asp:requiredfieldvalidator>

像RequiredFieldValidator ValidationGroup属性一样,它也存在于其他验证中.使用然后告诉".



Here This code will help your button stop for a while until value not saved in database
but the condition will be invisible,
for this you need to use an "image of please wait" this will show client to stop for a while you can also inrease time 5000 is the time in bracket and remeber it should be in thousand only least one you can give 1000 don;t go less than it.

If you would like to show this with an image use Update Panel and Update Progress

In Update declare your Image and call Id of Progress in Update Panel and also you can make css to fix the size of an image.

Coupled With, Use Proper validations to stop the above problems that client facing, use of Validation group in Validation properties.

Like for example:-

<asp:button id="btSubmit" runat="Server" text="Submit" validationgroup="Submit" />

<asp:requiredfieldvalidator id="RFV_btn" runat="Server" validationgroup="Submit" controltovalidate="yourfieldId" setfocusonerror="True" errormessage="Fill Entries First" ></asp:requiredfieldvalidator>

Like RequiredFieldValidator ValidationGroup Property Exist in other validation also. Use and Then Tell.


您可以使JS单击按钮时按钮可见为假
就像onclick
button.style.display = none;
you can make button visible false on click by JS
like onclick
button.style.display=none;


JBSahu,

(我仅提供示例,根据您的要求进行更改)

如您所问,如何使用进度栏,请按以下步骤一一操作:

1)创建一个文件夹,当您将在解决方案资源管理器上单击鼠标右键时,将出现新文件夹"选项,将该文件夹命名为图像文件夹".

2)保存一张图片,请在该文件夹中等待

3)放css如下图:-

Hi JBSahu,

(I am giving only examples alter it as you requirement)

As You asked me about,how to use progress bar, please follow below steps one by one:

1)make a folder, When You will Right click on solution explorer New Folder option will come Take that folder and name as "Image Folder".

2)save one Image of Please wait inside that folder

3)put css shown below:-

<style type="text/css"><br />
.progress<br />
        {<br />
         height:58px;<br />
         width:72px;<br />
         background-image:url(''images/progress.gif'');<br />
<br />
        }<br />
<br />
</style>



4).进入更新面板并更新进度

参见下面的代码:-



4).Take update panel and Update Progress

see code below:-

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
         <ProgressTemplate>
          <div class="progress">
         <img src="Images/progress.gif" />

          </div>
       </ProgressTemplate>
            </asp:UpdateProgress>





更新面板



and

Update Panel

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Button ID="btnshowReport" runat="server" onclick="btnshowReport_Click"

                    Text="ShowReport" CommandName="EDIT"  />
</ContentTemplate>
</asp:UpdatePanel>



将按钮放在更新面板的单击事件中,编写此代码



Put your button inside the update panel at its click event write this code

System.Threading.Thread.Sleep(5000);



然后告诉我它是否正常工作



and then tell me it is working or not


这篇关于如何在客户端站点中执行页面.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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