|
hello,
first of all you need to have runat=server for these controls then only you can able to access from code behind
from:
krishna
|
|
|
|
|
Hi All
How to ignore html tags i want to show html tags in the Lable
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Replace < with < and > with > in the label's text. The Literal control has a property Mode , which when set to "Encode " achieves the same thing.
|
|
|
|
|
You can use < and > instead of < and >
|
|
|
|
|
HI Everybody
i am new in asp.net.I am currently working on a e commerce project.
Can anybody tell me how to change items on home page on every page refreshed.
Whenever user refreshed a page i have to show new items every time on home page
which is coming from my database.i ma using asp.net with vb.net.
Thanks in advance.
Rahul
df
|
|
|
|
|
Presuming you have some sort of item ID for each item in the database, generate a random number between the lowest and highest values in your database, and feed that number into the query that pulls the item to be shown out of the database. If you want to show multiple items, you'll need to check for duplicates.
|
|
|
|
|
As you are new please note the following:
1. Please read the forum guidelines. Messages should have appropriate titles. Not 'help' or 'urgent.'
2. You have a previous post of garbage. Please delete this.
______________________
stuff + cats = awesome
|
|
|
|
|
|
Hi All,
first of all, I am extremely sorry for asking the same question again!
my problem is i am trying to send an email in asp.net 2.0. But I keep on getting an exception whenever i try to send..
Here is the exception<b>
Send failure: System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e)</b>
and here is my code:
protected void btnSubmit_Click(object sender, EventArgs e)
{
SmtpClient smtpClient = new SmtpClient();
MailAddress objMail_From = new MailAddress("username@gmail.com");
MailAddress objMail_To = new MailAddress("username@gmail.com");
MailMessage objMail = new MailMessage(objMail_From, objMail_To);
objMail.Subject = "Email-Test Example";
objMail.IsBodyHtml = true;
objMail.Body = "<html><head><title>Sending E-mails with ASP.NET 2.0 using CSharp</title></head><body>" + "<p>Company : " + lblCompany1.Text + "</p>" + "<p>Address : " + lblAddress1.Text + "</p>" + "<p> Telephone :" + lblTelephone1.Text + "</p>" + "<p> Fax :" + lblFax1.Text + "</p>" + "<p> Email : " + lblEmail1.Text + "</p>" + "<p>Comments : " + lblComments1.Text + "</p>" + "</body></html>";
objMail.Priority = MailPriority.High;
smtpClient.Host = "smtp.yahoo.com";
smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx");
smtpClient.UseDefaultCredentials = false;
smtpClient.EnableSsl = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
try
{
smtpClient.Send(objMail);
Response.Write("Your mail has been sent");
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}
and in the web.config i put it like this:
<configuration>
<system.net>
<mailSettings>
<smtp>
<network
host =" smtp.gmail.com"
port =" 587"
userName = "username@gmail.com"
password ="xxxxxx"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
_________
could any one please help me on this... plz..
Thank in Advance.
|
|
|
|
|
DKalepu wrote: smtpClient.Host = "smtp.yahoo.com";
smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx");
Gmail credentials with yahoo smtp server? You probably should use Gmail's smtp in this case.
|
|
|
|
|
oops...... I pardon for it! that was such a silly mistake...
i hv changed it to gmail smtp..it throws anoter exception now:
Send failure: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required z15sm3365130pod at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in
------
|
|
|
|
|
I tried you code and it seems the line smtpClient.UseDefaultCredentials = false; causes this Exception, so I commented it out and then it worked just fine.
|
|
|
|
|
i wanna clear all the text boxes in the web page in asp.net
i wrote a function in the code like this ....
private void cleartextBox(System.Web.UI.WebControls.TextBox cc)
{
foreach (Control c in cc)
{
if (c.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
{
c.text = "";
}
}
}
plz help me....
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
Control myForm = Page.FindControl("Form1");
foreach (Control ctl in myForm.Controls)
{
if(ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{
ctl.Text="";
}
}
it will work...check it...
-- modified at 8:14 Thursday 14th June, 2007
Pradeep Reddy
|
|
|
|
|
private void ClearTextBoxes(params [] TextBox txts)<br />
{<br />
foreach (TextBox TB in txts)<br />
{<br />
TB.Text = ""; <br />
}<br />
}
I Love SQL
|
|
|
|
|
foreach(Control control in Page.Controls )<br />
foreach (Control childControl in control.Controls)<br />
{<br />
<br />
if(childControl is TextBox)<br />
((TextBox)childControl).Text = string.Empty;<br />
<br />
}<br />
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
private void Reset()
{
Control myForm = Page.FindControl("Form1");
foreach (Control ctl in myForm.Controls)
{
if (ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
((TextBox)ctl).Text = "";
}
}
---Hope it helps...
JJ
|
|
|
|
|
I saw you got a few answers to your question, however it seems (without the intention to criticize the others responses) that none of them solve the given task in all scenarios. Problems may arise due to the fact, that for each Control the Controls collection only contains its child controls but not the children of the child controls. This can cause problems if the nesting of the TextBoxes is deep. A simple case of this would be if the TextBox was inside a TableCell. Iterating through the Forms controls can only get you the Table object, and even if you iterate through Tables controls, you only get TableRows. The correct solution is to iterate through the Forms children, then through its childen's children and so on. A recursive algorithm if you like. Something along the lines of:
void ClearTextBoxes(Control control)
{
foreach (Control child in control.Controls)
{
if (child is TextBox)
((TextBox)child).Text = String.Empty;
else
ClearTextBoxes(child);
}
} Obviously if the nesting does not run deep than you don't need this kind of precision.
|
|
|
|
|
Its possible to sho msg box in asp.net with out javasctipt?,
If there plz send me the code....,
Magi
|
|
|
|
|
I hope not.
Regards,
Satips.
|
|
|
|
|
|
This is pretty good concept of showing MessageBox
|
|
|
|
|
Magh_M wrote: with out javasctipt?,
it pretty much good que, but without javascript, you can use VBscript,
but without scripting
i don't think we can do.
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Hi,
My webpages are flickering/Blinks during post backs.... in both IE7.0 and Firefox.
Its working fine in IE6.0....
Plz Help.
~JJ
|
|
|
|
|
Page.SmarNavigation = true;
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|