|
document.getElementById('labelName').style.visibility='visible';
paid attention, if the label is located into contentplaceholder the code will be like that:
document.getElementById('ctl00_ContentPlaceHolder1_labelName').style.visibility='visible';
Eric H.
|
|
|
|
|
aaraaayen wrote: How to change the visible property of asp control asp:Label in javascript code.
That is not possible. The server control only exists on the server, and the client script only exist in the browser.
If you want to hide an element with Javascript, use the display or visibility styles.
---
b { font-weight: normal; }
|
|
|
|
|
Try it!
1) Add a HTML Button and an ASP label control
2) Double-Click the button and you will get into the javascript code
3) Past this code
function Button1_onclick() {
if (document.getElementById("lbl").style.visibility=='hidden')
document.getElementById("lbl").style.visibility='visible';
else
document.getElementById("lbl").style.visibility='hidden';
}
Eric H.
|
|
|
|
|
I don't have to try your code, I know what it does.
What it does not do, however, is to change the Visible property of the server control. As I already explained, that is not possible.
---
b { font-weight: normal; }
|
|
|
|
|
If I understood right, he wants to show/hide an ASP:Label control server through javascript, doesn't he? If yes, I try the code that I had posted above and it works very fine.
Eric H.
|
|
|
|
|
ayeleteric wrote: If I understood right, he wants to show/hide an ASP:Label control server through javascript, doesn't he?
That is perhaps what he wants to do, but that was not what he was asking about.
If you are answering the question that you think that he should have asked instead of the question that he actually asked, you have to specify what question it is that you are answering.
---
b { font-weight: normal; }
|
|
|
|
|
HI,
I tried in this way. I am calling this function in textbox onclick but in that stage visible property of the label is false. Once i click update button, its visible is true. Now once again when i leave update button that visible have to set as false. But when i tried i am getting error message like this.
function visiblechange()
{
if(document.getElementById('Label1').style.visibility ='visible')
{
document.getElementById('Label1').style.visibility='hidden';
}
}
Error Message:
Microsoft JScript runtime error: Object required
Please help. Thanks in advance.
Prya
|
|
|
|
|
Try this
You maybe have 2 problems:
1) You have to write =='visible' not ='visible' when you are checking if the label is visible.
2) Your label may be located on a contentpalceholder so for be sure write
getElementById('<% 'Label1'.clientId %>')
Try it and advise
function visiblechange()
{
if(document.getElementById('<% 'Label1'.clientId %>').style.visibility =='visible')
{
document.getElementById('<% 'Label1'.clientId %>').style.visibility='hidden';
}
}
Eric H.
|
|
|
|
|
label's id.style.display = "block" or "none"
|
|
|
|
|
Hi friends
how to build dll file in the bin folder of web appliction in asp.net 2.0
IN ASP.NET 1.1,DLL FILE CREATED WHEN WE BUILD APPLICATION
plz reply me soon
Thanks
PaTHaN
-- modified at 8:47 Thursday 23rd November, 2006
|
|
|
|
|
c# in asp.net
iam using data grid paging in connected model iam getting below exception
iam using the below code
public void DataGrid1_PageIndexChanged( object s, DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
getrec(); // binds the record in to a datagrid in connected model
}
AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID dgrdTitles when AllowPaging is set to true and the selected datasource does not implement ICollection.
plz let me know
with regards
|
|
|
|
|
ravikiranreddydharmannagari wrote: AllowCustomPaging must be true
This property should be set to true
Also rather than calling getrec(); in PageIndexChanged method, create an event PreRender and call the inbuilt DatBind() method in it like
<br />
this.PreRender+=new EventHandler(WebForm1_PreRender);
<br />
private void WebForm1_PreRender(object sender, EventArgs e)<br />
{<br />
DataBind();<br />
}<br />
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
how i upload Directories/folder on FTP Server...
Plzzz Send Me some source code or Demo
|
|
|
|
|
I already told you that demanding source code will get you nowhere. DOUBLE POSTING will result in everyone ignoring you completely.
____________________________________________________
If at first you don't succeed, skydiving might not be for you.
|
|
|
|
|
I know its not terribly good practice but we need this as a quick, short tearm, fix.
I just want a simple 1 username and password defined in the web.config for use with the premade Login tool login method.
Here is a snippet of the current web.config .. but it does not allow anyone in despite declaring a user in it:
<br />
<authentication mode="Forms"><br />
< forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH"><br />
<br />
<credentials passwordFormat="Clear" ><br />
<user name="john"<br />
password="keyboard"/> <br />
</credentials> <br />
</forms><br />
</authentication><br />
< authorization><br />
<deny users ="?"/><br />
<allow users="john"/><br />
<br />
</authorization><br />
Can any one shed some light oon the correct way of doing this please ?
|
|
|
|
|
This is from asp.net technical articles site
Listing 8. Denying anonymous users access
<authorization>
<deny users=? />
</authorization>
We could also have added <deny> elements for specific user names, allowed access to some users and not others, and so on.
User names and passwords
For our purposes, the easiest way to store user names and passwords is in the Web.config XML file, right alongside the other authentication information. In reality, because user names and passwords are accessed programmatically in ASP.NET (as we will see shortly), you could easily retrieve them from a database or a customized XML file of your own design. In many cases such methods will be preferable (and possibly more similar to what you did with your JSP applications), so we will point out where and when such code should be added when we look at the ASP.NET code in just a moment.
For now, find the <authentication> element in Web.config again and add to it so that it looks like Listing 9.
Listing 9. Storing user name and password information in Web.config
<authentication mode="Forms">
<forms name="LoginForm" loginUrl="login.aspx" protection="All" />
<credentials passwordFormat="Clear">
<user name="craig" password="secret"/>
</credentials>
</forms>
</authentication>
Using the <credentials> element, we have added one user to the list of potential users for this application. We will see in a moment how to check against the users in this list. For now, note the passwordFormat attribute; a value of Clear indicates that this password will be readable to humans (that is, unencoded). Additional values are available that will cause the password to be encrypted before being sent across the network.
Designing a login form
Unlike in our JSP example, we can take advantage of Visual Studio .NET and design the appearance of our ASP.NET login form using the forms designer, and place all important code in the CodeBehind file. This allows us to have a much better idea of what the form will look like while designing it, and also allows us to keep most of the C# code separate from the HTML page design.
We'll start by adding a new form to the project called Login.aspx. We can add some text fields and a button to this form to make it look similar to the form we created in our JSP example simply drag and drop the necessary components into the design window and arrange them.
Now, open the CodeBehind file for Login.aspx. Here we need to add code in two different places. First, we need to add the following using directive to the top of the page:
using System.Web.Security;
This namespace contains all the necessary classes for ASP.NET security.
We then need to add some code to verify the user name and password to the Click method corresponding to our login button. If your CodeBehind does not already contain a Button1_Click method, go back to the form editor and double-click the login button to create one. Inside Button1_Click, add code as shown in Listing 10.
Listing 10. Button1_Click code for forms-based authentication
private void Button1_Click(object sender, System.EventArgs e) {
if (FormsAuthentication.Authenticate(TextBox1.Text, TextBox2.Text)) {
FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
} else {
Label1.Text = "Login failed. Please try again.";
}
}
keep Learning and you never will be out of date...
|
|
|
|
|
I am unable to send mail using CDOSYS. My code is as follows: -
MailMessage msgPsw = new MailMessage();
string strBody = "How r u";
msgPsw.To = "abc@yahoo.com";
msgPsw.From = "aasstt@vsnl.com";
msgPsw.Cc = strDbMailID;
msgPsw.Subject = "Hi";
msgPsw.Body = strBody;
msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtserver", "server IP address");
msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendserverport", "25");
msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username");
msgPsw.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password");
try
{
SmtpMail.Send(msgPsw);
}
catch(System.Web.HttpException ehttp)
{
string strError = ehttp.Message + "" + ehttp.ToString();
LabelErr.Text = strError ;
}
Can somebody please help me
aasstt
|
|
|
|
|
Here's some vb 2005 code that works
Dim smtpMail As New System.Net.Mail.SmtpClient<br />
Dim emlMessage As New System.Net.Mail.MailMessage()<br />
With emlMessage<br />
.From = New System.Net.Mail.MailAddress(emailAddressTextBox.Text, nameTextBox.Text)<br />
.Subject = subjectTextBox.Text<br />
.Body = messageTextBox.Text<br />
.To.Add(emailAddressTextBox.Text) 'you can add as many email addresses as required<br />
.IsBodyHtml = False<br />
End With<br />
With smtpMail<br />
.Host = "smtp.domain.com"<br />
.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network<br />
.Credentials = New System.Net.NetworkCredential("SmtpServerLogonName", "Password")<br />
.Send(emlMessage)<br />
End With
Steve Jowett
|
|
|
|
|
Do you have installed the Virtual Mail Service in your Server?
These code is at C# language, and use the localhost (IIS) mail Service.
<br />
private void SendEmailToClient(string to, string bodyMessage)<br />
{<br />
SmtpClient smtpClient = new SmtpClient();<br />
MailMessage message = new MailMessage();<br />
try<br />
{<br />
MailAddress fromAddress = new MailAddress("YOUR EMAIL", "YOUR NAME");<br />
<br />
smtpClient.Host = "localhost";<br />
<br />
smtpClient.Port = 25;<br />
<br />
message.From = fromAddress;<br />
MailAddress toAddress = new MailAddress(to);<br />
message.To.Add(toAddress);<br />
message.Subject = "This is an Email Test";<br />
<br />
message.CC.Add("admin@yoursite.com");<br />
<br />
message.Bcc.Add(new MailAddress("moraleso@fmmb.org"));<br />
<br />
message.IsBodyHtml = false;<br />
<br />
message.Body = bodyMessage;<br />
smtpClient.Send(message);<br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
Mensaje.Text = "You couldnt send the email" + ex.Message;<br />
}<br />
}<br />
keep Learning and you never will be out of date...
|
|
|
|
|
hello friends,
i am developing an sms messaging system using some third party tools and asp.net as GUI i am having an exe file
sendmsg.exe recipient=+65073223,+659988322 text="Hello"
which can be executed from command line and we can send sms to number of people
i want to execute this command from my web application on click of single button how can i do this can anybody help me
regards jabbar
jabbarsb
|
|
|
|
|
hi,
can u tell me which third party tool you are using?
are you using modem?
Reply awaited...
Nitin...
|
|
|
|
|
hi,
we are using mozat m2u and we are using modem to send sms
regards jabbar
jabbarsb
|
|
|
|
|
hi,
thanks jabbar!
even i am trying to built a sms system.
i ll take a look at this product.
thanks for ur information.
Nitin...
|
|
|
|
|
Hi,
I want to create a two level dropdown menu in an ASP.Net Application. Can any1 suggest me how to go abt in doing this? Which site should i refer to get a suitable code for it?
It is very urgent.
Thanks,
Rizzz
Rizzz
|
|
|
|
|
Hi rajiya
take it Link[^]
|
|
|
|