|
How can i store entire path of a file which has uploaded through asp.net uploadfile control?.
i want to store in sql database entire path of a uploaded file.
plz help me
yogesh
|
|
|
|
|
Do you know where you saved the file in server ?
|
|
|
|
|
FileUpload1.PostedFile.Name gives the entire path of the file in client machine...but this works only in IE in firefox or any other browser u will get only the file name ...
But why do u want to store entire path of the file when located in client's machine? When a file is uploaded u will save it at server and hence store the serverpath of the filename
Koushik
|
|
|
|
|
Why? That path only makes sense on the client computer, the server can't use it for anything.
Some browsers doesn't return the comple path, and some antivirus/firewall software removes the complete path, so there is no guarantee that you will even get the complete path to the server.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hello,
i want to allow users to copy an entire row from excel, and then with one "ctrl+v", this row will be pasted to a gridview in my web app. is this possible?
Thanks in Advance.
|
|
|
|
|
You could provide a textbox which you can paste the row into which can then be processed and added to the gridview, the input of the textbox could easily be split at vbTab.
|
|
|
|
|
Thanks for eary reply.
But i want to copy the row from Excel of 3 columns and i want to paste on gridview it exactly shows the row of 3 columns.
|
|
|
|
|
Hi,
I have following requirements. User can copy/Paste contents from excel sheet to ASP.NET gridview control. I have a custom grid view control. How can i do this.
Can someone throw some idea how can i implement this with some design/code etc.
Thanks in advance
|
|
|
|
|
Hello Everybody
Table name dbo.Category in SQL SERVER 2005 and DropDownList name ddlCategory on my asp.net page.
ddlCategory.DataTextField = "CATEGORY NAME" (which is coming from SQL SERVER 2005)
how can i get ddlCategory selected item identity? (without write function, like function getCategoryID( categoryname as string) as integer)
waiting for your reply
Sarfarj Ahmed
|
|
|
|
|
before doing DataBind set the DataValueField of the DropDownList.
ddlCategory.DataValueField = "CategoryID".
Get the value of Selected Item Using
ddlCategory.SelectedValue
Regards - J O H N -
|
|
|
|
|
This is my code,
I put your code but cant bind the data, could please have a look and please tell me what should i do
Protected Sub ddlCategory_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlCategory.Init<br />
Dim conn As SqlConnection = New SqlConnection(Web.Configuration.WebConfigurationManager.ConnectionStrings("OxfordLibrary").ConnectionString)<br />
Dim queryString As String = "SELECT CATEGORYNAME AS 'CATEGORY NAME' FROM BOOKSCATEGORY ORDER BY CATEGORYNAME ASC"<br />
Try<br />
conn.Open()<br />
Dim comm As SqlCommand = New SqlCommand(queryString, conn)<br />
Dim adapter As SqlDataAdapter = New SqlDataAdapter(comm)<br />
Dim ds As DataSet = New DataSet()<br />
ds.Clear()<br />
adapter.Fill(ds)<br />
<br />
ddlCategory.DataSource = ds<br />
ddlCategory.DataTextField = "CATEGORY NAME"<br />
ddlCategory.DataBind()<br />
<br />
ddlCategory.Items.Insert(0, New ListItem("Select One..", "Value"))<br />
<br />
<br />
conn.Close()<br />
Catch ex As Exception<br />
<br />
conn.Close()<br />
End Try<br />
End Sub
Sarfarj Ahmed
|
|
|
|
|
Sarfaraj Ahmed wrote: Dim queryString As String = "SELECT CATEGORYNAME AS 'CATEGORY NAME' FROM BOOKSCATEGORY ORDER BY CATEGORYNAME ASC"
CategoryID missing in the Select Query.
Regards - J O H N -
|
|
|
|
|
im writing code
ddlCategory_init()
should i changed it to
ddlCategory_SelectedIndexChanged()
or
ddlCategory_textchanged()
Sarfarj Ahmed
|
|
|
|
|
Im geting CategoryID = select one..
Dim queryString As String = "SELECT CATEGORYID, CATEGORYNAME AS 'CATEGORY NAME' FROM BOOKSCATEGORY ORDER BY CATEGORYNAME ASC"<br />
Try<br />
conn.Open()<br />
Dim comm As SqlCommand = New SqlCommand(queryString, conn)<br />
' Dim dataReader As SqlDataReader = comm.ExecuteReader()<br />
Dim adapter As SqlDataAdapter = New SqlDataAdapter(comm)<br />
Dim ds As DataSet = New DataSet()<br />
ds.Clear()<br />
adapter.Fill(ds)<br />
ddlCategory.DataSource = ds<br />
ddlCategory.DataTextField = "CATEGORY NAME"<br />
ddlCategory.DataValueField = "CategoryID"<br />
_CategoryID = ddlCategory.SelectedValue<br />
ddlCategory.DataBind()<br />
ddlCategory.Items.Insert(0, New ListItem("Select One..", "Value"))<br />
<br />
<br />
conn.Close()<br />
Catch ex As Exception<br />
<br />
conn.Close()<br />
End Try
Sarfarj Ahmed
|
|
|
|
|
The problem is not with the DropDownList. You better find a Good ASP.NET book to quickly learn the basics.
Regards - J O H N -
|
|
|
|
|
Very Strong Answer
Thanks
Sarfarj Ahmed
|
|
|
|
|
Sarfaraj Ahmed wrote: Very Strong Answer
Intensely Practical solution.
Sarfaraj Ahmed wrote: Thanks
You're Welcome.
Regards - J O H N -
|
|
|
|
|
Thanks John
I am really really sorry. I didnt get you from the very first time. Now I got my own answer.
Thanks For Your Help
Im going to give you maximum point.
Sarfarj Ahmed
|
|
|
|
|
Hi I need scrollbars on top of my page also...,
How to do that?,
Regards,
Magi
|
|
|
|
|
Write your page upside down then turn your monitor upside down as well.
|
|
|
|
|
iam working on web parts .i kept the label in webpartzone .after debugging iam not getting the minimize button (down arrrow in the label)how can i resolve this problem
|
|
|
|
|
hi,
i got the below code in my page.
protected string ConvertPercent(object number)
{
if (number == DBNull.Value)
return "-";
else
if (number.ToString().StartsWith("-"))
{
ChangePercent1.ForeColor = Color.Red;
return String.Format("{0:F}", number);
}
else
ChangePercent1.ForeColor = Color.Black;
return String.Format("+{0:F}", number);
}
but it seems i getting an error saying
"Object reference not set to an instance of an object"
The ChangePercent1 was initialize using
public System.Web.UI.WebControls.Label ChangePercent1;
BUT still errors persists. Please help me.....
Thx.
|
|
|
|
|
What a disaster.
Why are you using ToString ? Why are you passing an object ?
If number == null, this code will give that error. If you're using .NET 2.0, I'd suggest passng an int?, checking for null, then using if number < 0 instead of a tostring call that may not work for all locales and is needlessly expensive.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hy
I have a site on a host for ASP.NET.
I have a file with 30000 records.
I have a .mdf file with a table with 30000 records.
Method 1
I read from file a record and diplay in a label.
Label1.Text = File.ReadAllLines(Server.MapPath("~/fisier.txt"),Encoding.UTF8)[index];
Method 2
I read from .mdf file from my table the same record.
Can tell me witch of the 2 method is faster?
thx
|
|
|
|
|
Probably the second, but both are a disaster, obviously.
Well, readalllines returns a string[] as I recall, so it won't compile. ReadAllText is probably faster than the database solution, as it mindlessly reads and passes a single string.
This does NOT mean that flat files are faster than databases.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|