<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript">
// Get the instance of PageRequestManager.
var prm = Sys.WebForms.PageRequestManager.getInstance();
// Add initializeRequest and endRequest
prm.add_initializeRequest(prm_InitializeRequest);
prm.add_endRequest(prm_EndRequest);
// Called when async postback begins
function prm_InitializeRequest(sender, args) {
// get the divImage and set it to visible
var panelProg = $get('divImage');
panelProg.style.display = '';
// reset label text
var lbl = $get('<%= this.lblText.ClientID %>');
lbl.innerHTML = '';
// Disable button that caused a postback
$get(args._postBackElement.id).disabled = true;
}
// Called when async postback ends
function prm_EndRequest(sender, args) {
// get the divImage and hide it again
var panelProg = $get('divImage');
panelProg.style.display = 'none';
// Enable button that caused a postback
$get(sender._postBackSettings.sourceElement.id).disabled = false;
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblText" runat="server" Text=""></asp:Label>
<div id="divImage" style="display:none">
<asp:Image ID="img1" runat="server" ImageUrl="~/images/progress.gif" />
Processing...
</div>
<br />
<asp:Button ID="btnInvoke" runat="server" Text="Click"
onclick="btnInvoke_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
Its simple during intialise request , you can show image and during endrequest you can hide image , same thing you can do with simple ajax request , while doing request , show that image , than onsucceed or onfail function of ajax call hide it with proper
message.
Please if your thread get resolved ,'Mark as Answer' to reflect the right status.
__________________________________________________
ARMY: Reason to PROUD
if thats the case you have to continuosly communicate with your server using mutliple post back...if you simply want a text rather than image you can use this
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
Processing Pdf File..............
</ProgressTemplate>
</asp:UpdateProgress>
again this will hide and unhide already...no need for extra codes
Please if your thread get resolved ,'Mark as Answer' to reflect the right status.
__________________________________________________
ARMY: Reason to PROUD
shivanand G ...
Participant
1777 Points
537 Posts
how to show message to client on server side operation?
Aug 03, 2012 07:34 AM|LINK
Hi friends..
i am uploading pdf file... if i click upload.. i will check the pdf file ..
pdf file page size .... shoud show message size checked or else invalid size if it suceessfull size then
it will check lansacpe or potrate.. and so on operation...
but while checking the pdf file i want to show message to client this opeartion is going like.. progress bar..
Plz help me.
regard.
shivanand(shivu.betta@gmail.com)
shivanand.G.N (shivu.betta@gmail.com)
mbavila
Member
66 Points
56 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 07:40 AM|LINK
Are you using update panels? use updateprogress
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<img alt="Loading..." src="../Image/LoadingSprite.gif" style="height: 16px; width: 14px" />
</ProgressTemplate>
</asp:UpdateProgress>
image will be shown everytime you do server side processing
softvishu
Member
642 Points
166 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 07:42 AM|LINK
<form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript"> // Get the instance of PageRequestManager. var prm = Sys.WebForms.PageRequestManager.getInstance(); // Add initializeRequest and endRequest prm.add_initializeRequest(prm_InitializeRequest); prm.add_endRequest(prm_EndRequest); // Called when async postback begins function prm_InitializeRequest(sender, args) { // get the divImage and set it to visible var panelProg = $get('divImage'); panelProg.style.display = ''; // reset label text var lbl = $get('<%= this.lblText.ClientID %>'); lbl.innerHTML = ''; // Disable button that caused a postback $get(args._postBackElement.id).disabled = true; } // Called when async postback ends function prm_EndRequest(sender, args) { // get the divImage and hide it again var panelProg = $get('divImage'); panelProg.style.display = 'none'; // Enable button that caused a postback $get(sender._postBackSettings.sourceElement.id).disabled = false; } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="lblText" runat="server" Text=""></asp:Label> <div id="divImage" style="display:none"> <asp:Image ID="img1" runat="server" ImageUrl="~/images/progress.gif" /> Processing... </div> <br /> <asp:Button ID="btnInvoke" runat="server" Text="Click" onclick="btnInvoke_Click" /> </ContentTemplate> </asp:UpdatePanel> </div> </form>Its simple during intialise request , you can show image and during endrequest you can hide image , same thing you can do with simple ajax request , while doing request , show that image , than onsucceed or onfail function of ajax call hide it with proper message.
__________________________________________________
ARMY: Reason to PROUD
Thanks,
Vishal Sharma
shivanand G ...
Participant
1777 Points
537 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 07:44 AM|LINK
hI i want do update message.. every conditon checking of the pdf file? not image.. can u send sample code?
shivanand.G.N (shivu.betta@gmail.com)
mbavila
Member
66 Points
56 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 07:47 AM|LINK
Update progress already has this feature...i cant understand why you would need to implement your own gude. It will hide and unhide on its own.
mbavila
Member
66 Points
56 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 07:50 AM|LINK
if thats the case you have to continuosly communicate with your server using mutliple post back...if you simply want a text rather than image you can use this
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
Processing Pdf File..............
</ProgressTemplate>
</asp:UpdateProgress>
again this will hide and unhide already...no need for extra codes
shivanand G ...
Participant
1777 Points
537 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 08:02 AM|LINK
Hi
softvishu
ur code is showing final checked condtion message.... i want to show all the message...... Help Me plz
if(condition)
{
labtext="mag here" fitst time it shoud show check of the file
if(condition)
{
labtext="mag here" 3ndtime it shoud show check of the file
if(condition)
{
labtext="mag here" 2ndtime it shoud show check of the file
}
else
{
labtext="mag here" 3ndtime it shoud show check of the file
}
}
else
{
labtext="mag here" 2ndtime it shoud show check of the file
}
}
shivanand.G.N (shivu.betta@gmail.com)
shivanand G ...
Participant
1777 Points
537 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 09:05 AM|LINK
hi..
softvishu
plz help me...
shivanand.G.N (shivu.betta@gmail.com)
shivanand G ...
Participant
1777 Points
537 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 09:07 AM|LINK
Hi
mbavila i want show all the message to client while running... i mean click of upload button..
if(condition)
{
labtext="mag here" fitst time it shoud show check of the file
if(condition)
{
labtext="mag here" 3ndtime it shoud show check of the file
if(condition)
{
labtext="mag here" 2ndtime it shoud show check of the file
}
else
{
labtext="mag here" 3ndtime it shoud show check of the file
}
}
else
{
labtext="mag here" 2ndtime it shoud show check of the file
}
}
shivanand.G.N (shivu.betta@gmail.com)
softvishu
Member
642 Points
166 Posts
Re: how to show message to client on server side operation?
Aug 03, 2012 09:14 AM|LINK
sorry , man , let me think...
__________________________________________________
ARMY: Reason to PROUD
Thanks,
Vishal Sharma