|
I agree with the previous comment, it seems like your SMTP mail server must be configured incorrectly in your web.config file. I tested your code (slightly modified), using localhost as the mail server; it worked just fine.
string TxtEmail = "Sue.Smith@123.com";
string TxtName = "Sue Smith";
string TxtMessage = "This is a test email message.";
using(MailMessage message = new MailMessage())
{
message.From = new MailAddress(TxtEmail, TxtName);
message.To.Add(new MailAddress("rohanrajpoot@in.com"));
message.Subject = "This person has contacted us!";
message.IsBodyHtml = false;
message.Body = TxtMessage;
SmtpClient smtpClient = new SmtpClient { Host = "localhost" };
smtpClient.Send(message);
}
Regards,
Gary
|
|
|
|
|
Hi All,
Did any one know how to use HighSlide Popup in .net and I need to Show Routeplanner in highslide popup?
Can any one help me ?
Thankyou In Advance,
YamunaRani.
|
|
|
|
|
|
Hi Abhijit,
Thankyou for your reply.
Before posting this into Messageboard,i gone through the same Highslide site,the thing is here I am unable to download files which required as we need to pay amount for that.And the thing which i got as free is not useful for me.Becoz of that, i had sent this post, hoping that i will get any other solution.
Regards,
Yamuna
|
|
|
|
|
Hi,
Following is log of an error that we are frequently getting while invoking excel and perfoming calculations using asp.net (Excel 2007)
17Jul2009 13:03:42 INFO ODSReports.OrdStatsByPercentGraph - .Creating chart for OrdStatsBySKU
17Jul2009 14:14:51 WARN ODSReports.ODSExcelFunctions - Unable to programmatically set <CenterFooter> of PageSetup. Page formats might be incorrect. Please check and set Page setup options manually.The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
>>>>>>>.Exception here - Remote procedure call failed. Note that the chart prep has taken 1 hr +
17Jul2009 14:14:51 WARN ODSReports.ODSExcelFunctions - Unable to programmatically set <RightFooter> of PageSetup. Page formats might be incorrect. Please check and set Page setup options manually.The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
>>>>>> RPC is unavailable...
Notes:
1) We get this error only when we use a large dataset (e.g. working with > 10000 rows). Things work perfectly when we use smaller datasets (e.g. 1000 rows etc)
2) We did not see this on Excel 2003. Excel 2007 seems to be slower and also having this problem.
Do you know of any info/issues regarding excel 2007 and RPC disconnect/timeout etc ?
Thanks a lot for your time
|
|
|
|
|
hiiiiiii
i hav created a menucontrol dynamically and populated it through the database.
how can i now navigate to particular aspx page on click of the menu item.
on clicking each menu item i want to open the aspx page related to that menuitem.
thanks...
|
|
|
|
|
Set url to
NavigateUrl property of MenuItem.
i.e
menuItem.NavigateUrl = "Home.aspx"; //set url page to your according needs
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
I Should start typing fast
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Next time I wouldn't reply before you LOL
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
|
Use the NavigateUrl property
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi everyone,
i have created a contact form in my website. The empty contact form is going to the server. I have also put validations on that form...but the validations are not working.
Please help me in this regard.
|
|
|
|
|
er.puneet wrote: I have also put validations on that form...but the validations are not working.
What type of validations you have used??
If these are javascript validation make sure JS is enabled on your browser..Also post your code for better understanding of your problem
himanshu
|
|
|
|
|
i have used required field validation in asp.net.
here's the code:
<table align="center" class="appform" width="100%" cellpadding="2px" cellspacing="1px" border="0px">
<tr valign="top" align="left">
<td colspan="2">
<asp:Label ID="LblMsg" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
<tr valign="top" align="left">
<td>
Name:*</td>
<td>
<asp:TextBox ID="TxtName" runat="server" Width="270px"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TxtName" Display="Dynamic" ErrorMessage="*">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top" align="left">
<td>
Email ID:*</td>
<td>
<asp:TextBox ID="TxtEmail" runat="server" Width="270px"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TxtEmail" Display="Dynamic" ErrorMessage="*">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TxtEmail" Display="Dynamic" ErrorMessage="*"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr valign="top" align="left">
<td>
Phone Number:*</td>
<td>
<asp:TextBox ID="TxtPhone" runat="server" Width="270px"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="TxtPhone" Display="Dynamic" ErrorMessage="*">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ControlToValidate="TxtPhone" Display="Dynamic" ErrorMessage="*"
ValidationExpression="(^1300\d{6}$)|(^1800|1900|1902\d{6}$)|(^0[2|3|7|8]{1}[0-9]{8}$)|(^13\d{4}$)|(^04\d{2,3}\d{6}$)">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr valign="top" align="left">
<td valign="top">
Message:*</td>
<td>
<asp:TextBox ID="TxtMessage" runat="server" TextMode="MultiLine" Width="270px" Height="150px"></asp:TextBox>
</td>
<td valign="top">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TxtMessage" Display="Dynamic" ErrorMessage="*">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top" align="left">
<td>
</td>
<td>
<asp:Button ID="BtnSubmit" runat="server" onclick="BtnSubmit_Click"
Text="Submit" />
<asp:Button ID="BtnReset" runat="server" onclick="BtnReset_Click"
Text="Reset" CausesValidation="False" />
</td>
<td>
</td>
</tr>
</table>
|
|
|
|
|
Hi Puneet,
your code is fine and working..
Just make sure Java script is enabled in your browser
himanshu
|
|
|
|
|
hi himanshu,
javascript is enabled in my browser. I have also checked it in mozilla, safari and chrome...same problem occured again.
|
|
|
|
|
Do as I have suggested and validatge the Regx for Telephone number also.
|
|
|
|
|
Give Same ValidationGroup name to all the texbox Control, ValidationControl and the Submit Button Control. It should Work.
|
|
|
|
|
Hi Abhijit,
I tried by giving the same validation group name to all the textboxes, validation controls and the button control. But, still the form is submitting blank.
|
|
|
|
|
I did the same, and was working fine. By the way I removed the Regx For Telephone number an then tried.
|
|
|
|
|
Add the following to your web.config file
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
|
|
|
|
|
Hi Zafar,
i have updated the web.config file with the code that mentioned in your reply...But, still it's not working.
Can it be the problem with the server where the site is hosted??
|
|
|
|
|
which version u r using 2005 or 2008.
mention here.
i will try to solve your problem
and will post you the exact code.
is it working on local ?
|
|
|
|
|
Hi Zafar,
"which version u r using 2005 or 2008"
I am using .Net (version 3.5) with Sql Server 2005 on my local machine. And on the web server we have .net (v 2.0) with sql server 2005.
"is it working on local?"
The code is working perfectly on local; but the problem occured when i tried to run it on web server.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Text;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Contact_Us : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
About_Data();
}
}
public void About_Data()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["newcon"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select page_text,heading from PAGES where pid='10'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
string ctext = rdr["page_text"].ToString();
string htext = rdr["heading"].ToString();
LblText.Text = ctext;
LblHeading.Text = htext;
}
cmd.Connection.Close();
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
string y = BtnSubmit.ValidationGroup;
Page.Validate(y);
save_to_database();
send_data_to_mail();
TxtName.Text = "";
TxtEmail.Text = "";
TxtPhone.Text = "";
TxtMessage.Text = "";
}
protected void BtnReset_Click(object sender, EventArgs e)
{
TxtName.Text = "";
TxtEmail.Text = "";
TxtPhone.Text = "";
TxtMessage.Text = "";
}
public void save_to_database()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["newcon"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "insert into CONTACTUS (name,email,phone,message) values(@name,@email,@phone,@message)";
cmd.Parameters.Add("@name", SqlDbType.NVarChar, 100).Value = TxtName.Text.Trim();
cmd.Parameters.Add("@email", SqlDbType.NVarChar, 100).Value = TxtEmail.Text.Trim();
cmd.Parameters.Add("@phone", SqlDbType.NVarChar, 100).Value = TxtPhone.Text.Trim();
cmd.Parameters.Add("@message", SqlDbType.NVarChar, 4000).Value = TxtMessage.Text.Trim();
cmd.Connection.Open();
cmd.ExecuteNonQuery();
LblMsg.Text = "Your details are successfully saved in our database. We will get back to you soon!<br/> Thank you. ";
LblMsg.ForeColor = Color.Navy;
cmd.Connection.Close();
}
public void send_data_to_mail()
{
MailHelper.SendMailMessage(TxtEmail.Text, "rohanrajpoot@hotmail.com", "rohanrajpoot@in.com", "puneet.009@gmail.com", "This person has contacted us!", TxtMessage.Text);
}
}
|
|
|
|
|
you are using framework 3.5 on local while on server you are using 2.0
use the same on both.
Validation don't depend on code behind.
check the property CausesValidation="true" on submit or save button and also check the ValidationGroup
is the same for all controls you want to validate (if u r using Val Group)
i think it will solve your problem
|
|
|
|