|
Here is the code:
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
#region "Send email"
protected void btn_Sendmail_Click(object sender, EventArgs e)
{
{
// System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0
// System.Net.Mail.SmtpClient is the alternate class for this in 2.0
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromAddress = new MailAddress(TextBox2.Text, TextBox1.Text);
// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
smtpClient.Host = "localhost"; //localhost
//Default port will be 25
smtpClient.Port = 25;
//From address will be given as a MailAddress Object
message.From = fromAddress;
// To address collection of MailAddress
message.To.Add("issteam11@gmail.com");
message.Subject = "Feedback";
// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("issteam11@gmail.com")
message.CC.Add("issteam11@gmail.com");
message.CC.Add("issteam11@gmail.com");
// You can specify Address directly as string
message.Bcc.Add(new MailAddress("issteam11@gmail.com"));
message.Bcc.Add(new MailAddress("issteam11@gmail.com"));
//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;
// Message body content
message.Body = TextBox3.Text;
// Send SMTP mail
smtpClient.Send(message);
//lblStatus.Text = "Email successfully sent.";
}
catch (Exception ex)
{
//lblStatus.Text = "Send Email Failed. " + ex.Message;
}
}
}
#endregion
#region "Reset"
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox3.Text = "";
TextBox2.Text = "";
}
#endregion
}
This is how the form looks like
Feedback form
Your Name: textbox1
Your email address :textbox2
Your message :textbox3
|
|
|
|
|
Carol. wrote: / You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
smtpClient.Host = "localhost"; //localhost
//Default port will be 25
smtpClient.Port = 25;
Inspite of this can't you give just the domain name(mail.YourDomain.com)..
Best Regards,
Apurva Kaushal
|
|
|
|
|
I am not sure what u mean? no, I don't think it will work, it will generate some error. I am not very good with these codes, I just followed the codes given.
|
|
|
|
|
probably you would like to look at
this[^]
Best Regards,
Apurva Kaushal
|
|
|
|
|
hi all,
I just want to know how can i download an image from an URI specified..
please check it using this link.
http://a1472.g.akamaitech.net/f/1472/124/4h/img.ebags.com/is/image/im1/59011_1_1?&op_usm=.5,1,0,1&hei=249&wid=249
Please help me in this matter ASAP..
Thanx in advance..
Nicejith
|
|
|
|
|
Nice boot.
What is it that you are trying to do?
---
b { font-weight: normal; }
|
|
|
|
|
I just want to download the image shown in that URI and to save it in a folder in the server.
I can download other images given like www.abcd.com/xyz/image1.jpg.
But when i try to download the image in the given url there occurs an error- "Uri formats are not supported".
Now i'm using the code format as follows
wc= new WebClient();
wc.DownloadFile(givenurl,wheretosave);
Please help me to solve this problem..
Regards
Nicejith
|
|
|
|
|
What is the exact error message?
I tried your code with the url you gave in the original post, and it works just fine.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
The actual problem was with the url i supplied.The problem occured when i tried to upload bulk product details from a file to the application's database.The url contained blank spaces, i think. now i gave code for trimming and removing some extra parameters from the url in my application. Now it works smoothly..Thanks for the efforts you made..
Regards
Nicejith
|
|
|
|
|
Can any one send code for deleting an items from a datagrid control.
|
|
|
|
|
Here[^] you will get lots of example of datagrid which will be verymuch helpful.
Best Regards,
Apurva Kaushal
|
|
|
|
|
u actually delete the field from the database and rebind
as for how to do that u need to define a template column for delete and follwo the link given above
Best Regards
3ala2
|
|
|
|
|
Can any one tell me how to populate a dropdownlist in asp.net datagrid according to the index of the datagrid.
|
|
|
|
|
What do mean by index of the datagrid? To bind a dropdown list control you need to get the data in the datatable or dataset and then just set the datasourse property of the dropdownlist control to that datatable or dataset.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
I'm implementing mass information procedures that is stored in a SQL Database.
What methods and actions i need to take in order for the process to be faster in a case like this (its more then 1000000 rows).
I'm trying also to improve the memory usage since i use the DataTable in C# and I'm looking for a better way to process the retrieved data. is there a better class or method thats improving the speed and preventing any memory leaks ?
please advise....
Thanks for any help,
Lior S
|
|
|
|
|
There are a few recommendations:
1) Do not use ad hoc queries instead use Stored Procedures even to retrive data.
2) Do not use Typed Datasets. They are not efficient and take more memory.
3) Try to use Microsoft Enterprise Library Data Access Layer for better reliability and maturity to access DB.
4) If your target usersTry to use connection pooling.
5) Do not try to put dataset with 100000 rows on session or viewstate.
Hope it helps.
Regards
Khalid
|
|
|
|
|
Don't post the same question in multiple forums..
Best Regards,
Apurva Kaushal
|
|
|
|
|
Dear Sir, I m working on datagrid in asp.net using vb.net. I m using dropdown list in that datagrid. I have created a function for that from which data comes from a database. It is getting data but not according to the records index. What should I do. Plz if u can send me the code for that.
|
|
|
|
|
Safecom wrote: It is getting data but not according to the records index.
what do you mean ? explain more
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Sir I have get record like following
ID Name Address Position
in above Position is dropdown list. In this there is position of each name like 1,2,3,4. I want to display position acording to the names in that dropdown list in front of each name. But there is 1, 1, 1, 1 in all fields.
|
|
|
|
|
suppose the following:
your record structure is like this
ID Name Address Position
and have valuese
1 n1 ad1 p1
2 n2 ad2 p2
3 n3 ad3 p3
etc....
in the datagrid itemDataBound event set the DropDownList text value
to your records like this
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
Dim tempDpor As DropDownList= CType(e.Item.Cells(intIndex).Controls(1),DropDownList)
Dim strPostion As String =DataBinder.Eval(e.Item.DataItem, "Position")
tempDpor.text = strPostion
End Select
note that the intIndex is the column index where is your dropdown
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hello everyone,
I'm not sure if this is the correct place to post my question, here is how it goes:
I have an ASP .NET application with VB .NET as code behind. On a page, I have a flash form.
From flash form point of view:
1. Enter an ID and post the ID to an aspx file, say get.aspx, to communicate with database and get the details of the item, therefore return info as url variables to flash form to display (actionscript: using LoadVars functions).
2. After retrieving, I update the info from within the flash form and submit. Same way, post to another aspx file, say update.aspx, to update to the database.
Here is when my problem arises:
On step 1 above, when flash form request the get.aspx to retrieve info, this file actually enters the temporary inet files. Hence, when I enter the ID for the second time, the info retrieved is NOT the updated one. This is confirmed because I have checked database, correct values are updated. I have also tried manually deleting get.aspx and retrieve, this time update info is retrieved.
So for working around the above, I am thinking of deleting get.aspx after I have done updating the database in update.aspx. However, I have tried searching the internet, and couldn't find the way to do that using VB .NET.
Does anyone have any idea how I can solve this issue?
Thanks a bunch!!
|
|
|
|
|
It's alright guys, I just found out, just set get.aspx to non-cacheable, problems solved!
Cheers!
|
|
|
|
|
Hi dears,
I want to use several upload file controls in several pages like avatar uploader and file uploader ...! Now I want to configure web.config to set maximum lenght of uploaded files for these 2 control . how can I do that ?
thx,
|
|
|
|
|