473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Change the text in ASP:LABEL

I have a function Message_Show:

Public Sub Message_Show(ByVal sLabel As Label, ByVal sButton As Button,
ByVal sMessage As String, ByVal sButtonText As String)
If (IsPostBack) Then
sLabel.Text = sMessage
sLabel.Visible = True

sButton.Text = sButtonText
sButton.Enabled = False
End If
End Sub

I call this function in the SubmitBtn_Click

Message_Show(ITIN_Message, btnSubmit, "Retrieving data.... This may
take several seconds. Please be patient", "Retrieving")

The problem I'm having is this, it doesnt disable the button or show
the label until the datalist is populated. The SubmitBtn_Click function
does a DB query and populates a datalist. How can I get this to process
before the datalist is populated and shown?

Jul 28 '06 #1
1 4075
The problem is that you want to process this immediately, client-side, while
the processing takes place server-side on the postback.
You can do this with javascript, something along the following lines in your
aspx markup code (as one example).
This should give you a starting point, and you can change around the
javascript function to do exactly what you want.

Example Follows :>

<head>
<script>
function doClientCode(msg){
document.getElementById('<%=lblMyLabel.ClientID %>').innerText =
msg;
document.getElementById('<%=btnMyButton.ClientID %>').disabled =
true;
}
</script>
</head>
<body>
..... some markup .........................
<asp:label id="lblMyLabel" runat="server" text="" />
<asp:button id="btnMyButton" runat="server"
onclientclick="javascript:return doClientCode('Show this message.');"
text="Click Me" />
..... some markup .........................
</body>

If you are feeling adventurous, you could play around with an AJAX
framework, but i cannot give any advice as to the best way to do it that
way.
Jul 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hareth | last post by:
i got the idea "form.textbox.text = label.text" from vb... i tried it in C# but it generated errors i found a diff example from :...
1
by: Ray Cacciatore | last post by:
I'm using an asp:label to display source code on my web page. The source code is formatted with carriage returns, tabs and spaces. In the past, all I had to do was wrap the label in a <pre> element...
3
by: nick | last post by:
Is possible for server side code to access the text of <asp:label> changed by client side javascript code?
1
by: tshad | last post by:
How do I set up text (or can I) set up a label to automatically pull in text from a session variable. Something like: <asp:label text="<%# session("ClientName") %>" runat="server"/> This...
1
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
2
by: footballhead | last post by:
I do some design work on a website that up until to now has been limited to defining CSS and HTML elements. Excuse me if I am using incorrect terminology, I am just starting out in this. I would...
2
by: Sjaakie Helderhorst | last post by:
Hi there, I created my own user control (myControl) containing: myCaption - docked top myGrid - docked.fill (datasource: myDataset) myPanel - docked bottom This control is added to the form:...
5
by: Yohan Blurp | last post by:
Hi, Here is sample page to show you the problem : <html><body> <form action="/cgi-bin/test.cgi" method="post"> Data Path : <input type="text" size="50" value="C:\Test Data\May 2007.xls"...
1
by: zion | last post by:
Hello, How can I change label caption on page load ? Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.