|
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
|
|
|
|
|
It's working now... in IE 6.0, 7.0. Problem remains in Firefox.
I kept it in web.config
<system.web>
<pages smartNavigation="true"/>
</system.web>
Thanks U Sylvester,
Regards,
JJ
|
|
|
|
|
this query when exceuted on oracle client does show the data:
select sum(locked_items) as locked_items ,sum(total_item_count) as total_item_count , sum(failed_item_count)as failed_item_count from ita_job_audit where to_date(job_created_on,'dd/MM/yyyy') = to_date('13/06/2007', 'dd/MM/yyyy') group by worker_process_oid
but when exceuted from my asp.net application...donn get any data in the dataset..here the code:
OracleConnection conn = new OracleConnection();
DataSet ds = new DataSet();
OracleDataAdapter adapter= new OracleDataAdapter();
adapter.SelectCommand = new OracleCommand(@"select sum(locked_items) as locked_items ,sum(total_item_count) as total_item_count, sum(failed_item_count)as failed_item_count from ita_job_audit where to_date(job_created_on,'dd/MM/yyyy') = to_date('13/06/2007', 'dd/MM/yyyy') group by worker_process_oid", conn);
adapter.Fill(ds,"Jobs");
My problem is with the date format in the query...if i put some other where condition (which has no date) then it gets the data...but with this particular where condition..it donn wrk...
its something to do with how dot net send data to the oracle client...
could anyone help me out here plz..
Thanks,
Dee
|
|
|
|
|
Try:
select sum(locked_items) as locked_items,
sum(total_item_count) as total_item_count,
sum(failed_item_count)as failed_item_count
from ita_job_audit
where to_char(job_created_on, 'dd/MM/yyyy') = '13/06/2007'
group by worker_process_oid I think your "to_date(job_created_on,'dd/MM/yyyy') " is causing the job_created_on column to be implicitely cast to a string (using the default date format) - before you convert it back into a date.
Note that I have not been able to test this because I don't have access to Oracle at the moment.
Regards
Andy
|
|
|
|
|
Thank you Andy...it worked!
i had tried so many ways but not this way...thanks again
|
|
|
|