I am not familiar with the way you're uploading the files and the problems sounds really weird... but here is the best way to upload a file by using the FileUpload control: if (oFile.PostedFile != null) { string fullFileName = oFile.PostedFile.FileName; string fileName = System.IO.Path.GetFileName(fullFileName); oFile.PostedFile.SaveAs(Server.MapPath(string.Empty) + "\\" + fileName); }
this code will upload the file to the requested directory... (you can easily change the saving directory by editing the parameter in the SaveAs function..) and it should work with no problems... Good luck, Tal Kain.
Tal Kain
Posts
-
Can not copy fie to the server. -
Designing an Email applicationHey, Check out Syed Moshiur Murshed's tutorial for sending email using GMail[^]. in his tutorial you can see that one of the properties he configed was:
mailMsg.BodyFormat = MailFormat.Text;
MailFormat is an enum that one of his options is "HTML" that sends the email in html format (as you asked) and by using the class MailMessage you can render a html code and send it to the customer.. something like:string customerName = "....."; long customerId = 539482; string messege = "Hello " + customerName + " your Id is " + customerId.ToString() + "";
and then by using the Body property in MailMessage you can set the mail's text to the messege by using:mailMsg.Body = messege; //assuming mailMsg is the object of MailMessage
Hope I helped... Good luck :-) Tal Kain. -
error identification problemFirst, In what point this exception has been thrown? Second, from what is looks like in the error itself and in the information from the metadata and http://msdn2.microsoft.com/en-us/library/system.xml.xmlnodelist_members.aspx[^] it looks like XmlNodeList (or the classes it inherit from) doesn't implement the proper interfaces so it could be serialized... and you can't transfer it from your web service to the client... so it looks like this error leads to finding another way transfering the data ;) good luck, Tal Kain.
-
combobox find item by valueSo in the beginning I didn’t understand your exact problem... Anyway, At the moment the best way I think about to solve this problem is creating your own function that runs on the list of states and search for the specific id... so the function will return the index.. to make it easier You can even inherit from the class Combo Box and overload the function indexOf so it will do the job.. When I will have a better answer for this problem I will notify you :-) Good luck!
-
Bugs foundedHehe, I just replyed to the wrong messege... sorry ;-)
-
Do any body have an idea about plugins?There is also a version of Visual Studio (I think Professional/Team Developer) that supplies a specific type of project for all the Microsoft Office products (developing for Outlook/Word/Excel/etc...) it depends on the version of your Visual Studio 2005..
-
Bugs founded -
combobox find item by valueIf I understand your request You want to find the index of a value in the combo box and also getting the selected item index ? well, for getting the index of a value in the combo box:
cmbBox.Items.IndexOf("Male");
will give you the index of the object with the value of "Male".. and to get the selected item index you can use the property "SelectedIndex":cmbBox.SelectedIndex
to get the index...(or to set it..) and:cmbBox.SelectedText
for a string orcmbBox.SelectedValue
for an object (get && set) next time, make a little search on our good friend Google... You could find it easly.. Good luck. -
DataGridView In Form DesignerThe easiest way I know to work with a DataGridView is to create a DataTable… create its columns and then connect the DataTable to the DataGridView as its data source.. I created an empty form and throwed a DataGridView on it with the name "gridNumbers" here is the code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace DataGridExample { public partial class frmMain : Form { DataTable oTable; public frmMain() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { oTable = new DataTable(); oTable.Columns.Add("Number", typeof(int)); //with cell's type.. oTable.Columns.Add("Text"); //a simple way.. gridNumbers.DataSource = oTable; //connecting the table to the grid AddRow(1, "One"); AddRow(2, "Two"); AddRow(3, "Three"); AddRow(4, "Four"); } protected void AddRow(int num, string text) { DataRow oRow = oTable.NewRow(); //getting a row with the table's scheme oRow["Number"] = num; oRow["Text"] = text; oTable.Rows.Add(oRow); } } }
I tried to make this example as clear as possible... hope you got your answer :-) -
how to upload an document file?a little comment: you should check if a file was really sent before trying to save it :-)
if(FileUpload1.PostedFile != null) { //handle the incoming file }
have fun. -
Login Control CenteringYou can use
....
it works on firefox. enjoy.
-
free ASP.NET message board(forums) systemyeap:laugh:
-
free ASP.NET message board(forums) systemI thought you were sarcasm.... anyway, thanks..
-
free ASP.NET message board(forums) systemno... but i'm looking for more options.. I already found Community Server.. someone else told me about it.. so i wasnt supprised.. anyway, there is a step in the configurtion that says:
- If you try to run CS on Url other than localhost/cs (ie, the first paramater for cs_system_CreateCommunity), you must add the new Url using: exec cs_system_AddNewUrl 'localhost/cs', 'NEW_URL'
how can i do it ? i didnt understand this step... and yes, I'm probably a newbie.. but still.. that doesnt mean I'm an idiot.. :| thanks, Tal. -
free ASP.NET message board(forums) systemany other options? :|
-
free ASP.NET message board(forums) systemhey... I am looking for a free ASP.NET message board(forums) system that i could use in my website.. I found YetAnotherForum.net but with unknown reason i cant finish the installation on the remote server.. does anybody know other system that i could use? this is really important... thanks, Tal.