|
if
gaurav mangal wrote: userPostedFile.SaveAs(filepath + "\\" +
Saves the file to a given location on server,
Use a session to store the file path,
Session("FilePath")=userPostedFile.FileName
Then you can retrieve the file path from any page in your application.
ie String strFPath=Session("FilePath")
Now you know the file path, Then what is the problem of getting the file.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Thanks Sherin
Thanks a lot for your great suggestion .
after some modification its really works.
thanks......gaurav
|
|
|
|
|
hi sherin
actually i want to submit two picture at page 1 and want to show the picture at page 3 .
as per your code i am able to see the url at page 1 for two picture.but at third page only last image path show.
so plz tell me how i can see the picture at page third.
should i use any collection for that.
thanks....
|
|
|
|
|
Hi Gaurav,
In the code you've given its clear that you are saving the file in 'filepath' location.
That means the files you want in page three will be in the server by the time you want in page three..So...
What I feel is, at the same time save all the file names into a collection and store that in the session.
example:
List<string> myFiles = new List<string>();
myFiles.add(userPostedFile.FileName);
//Add this line after saving the file.
Then add it to a session
Session["MyFileCollectionNames"] = myFiles;
Now go to your third page. And check if this particular session is null or not. If not..
if(Session["MyFileCollectionNames"] != null)
{
List<string> myFiles = (List<string> )Session["MyFileCollectionNames"];
foreach(string sFileName in myFiles
{
// You can retrieve the file name from the variable sFileName here...
//Full file path : filepath + sFileName
}
}
Hope it helps
Thx,
Gayani
|
|
|
|
|
Thanks Gayani
Thanks a lot for your great suggestion .it works code is 100% currect .
but now i have one more prob. for you .plz advice .
actually now i can see the path of the images at page third. but i want to set the path at two image control at the page .how i can do it.because we are using collection how i can retrive images one by one.
thanks ...gaurav
|
|
|
|
|
Hi Gaurav,
Collections such as List<T> could be accessed by using the foreach.
So...here is the code to access each item.
List<string> myFiles = (List<string> )Session["MyFileCollectionNames"];
string sFilePath = //Set your file path here.
foreach(string sFileName in myFiles)
{
Image oImg = new Image();
oImg.ImageUrl = sFilePath + sFileName ;
Page.Controls.Add(oImg);
}
Hope it helps
Thx,
Gayani
|
|
|
|
|
thanks gayani
for this quick response.but i would like to say that when i used this which you have already suggest .then it not give me the right path of the image .
myFiles.Add(userPostedFile.FileName);
Session["file"] = myFiles;
Response.Write(Session["file"]);
and shows these lines .
System.Collections.Generic.List`1[System.String]System.Collections.Generic.List`1[System.String]
suggest me .
gaurav
|
|
|
|
|
Hi Gaurav,
One thing just noticed was that Session["file"] (Ill refer it in the code as Session["files"] since its more understanding I think ) as it actually has a collection and not a single file.
So lets do it like this...
Before writing the files to the page we need to traverse through the list.ie:
if(Session["files"] != null)
{
List<string> myFilesCol = (List<string> )Session["files"];
foreach(string sFileName in myFilesCol )
{
Responce.Write(sFileName);
}
}
Apart from accessing the list, another thing I noticed was that, when you are using the file upload control, I doubt whether you could get the client file path, but I believe you are refereing the the uploaded file name collection...
Hope its clear.
Thx,
Gayani
|
|
|
|
|
Hi,
How do i calculate the Start_cell_number and end_cell_number from Start_Display_datetime and end_display_datetime calcultion.
here is my code .
TimeSpan timeSpan1 = TimeSpan.Parse("8:00");//5:00 AM Start_dispaly_dateitme
TimeSpan timeSpan2 = TimeSpan.Parse("9:00");// 9:00 AM end_display_datetime
TimeSpan timeSpanDiff = timeSpan2.Subtract(timeSpan1);//hours difference
int mins = timeSpanDiff.Hours * 60 + timeSpanDiff.Minutes;//total minutes
int cells = mins / 15;//count number of cells
Now how i calculate the Start_cell_number and end_cell _number ?
first cell contains name of machines and from second cell i have to calculate .
Any hint is highly apperciated.
Best regards
Rameez
|
|
|
|
|
Hi ,
iam facing difficulty in arranging data from database to table control or
Gridview like this
in first cell of table i want to display Vehicle name and from second table cell i want to display reservations against name of vehicle like this
iam getting Data into dataset .
Channel T1 T2 T3
C1 P1 NA P3
C2 NA P2 NA
Any help or hint?
Best regards
Rameez
|
|
|
|
|
Populate dataset and from there bind your dataset to gridview.i don't know if this will help
Gridview .datasource = dsvihicle
gridview.databind()
Mamphekgo
|
|
|
|
|
hi
m trying to store and retrieve image in sql database.
m having a problem in retrieving it....
all the bytes are not retrieved only first 13 bytes are retrieved..
can anybody help me with his... how can i retrieve all bytes from sql table..????
|
|
|
|
|
Member 3486231 wrote: all the bytes are not retrieved only first 13 bytes are retrieved..
Do you think the, problem is with visual studio or sqlserver?
What is the data type in sqlserver?
Can you show some code?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
hi everybody i have looked evrywhere but cant find the solution for this....
i want to display word document stored in sql database and i want to show
that document in browser....please help of point me in right direction
thanks in advance...
appu
|
|
|
|
|
Hi Appu,
I assume you have saved the word doc in the SQL Server as a byte array...
and here is the code..
byte[] byteArray = //Get your byte array - ( file content )and assign it here.
string sFileName = //Get your fileName and assign it here
Response.AppendHeader("Content-Type", "application/msword");
Response.AddHeader("Content-Disposition", "attachment; filename=" + sFileName);
Response.BinaryWrite(byteArray);
Response.End();
Hope it works
Thx,
Gayani
|
|
|
|
|
Hello All,
Have a problem where I would like to display a column only if a particular item is selected in a drop down.
To be more specific, I display some values in a gridview and the last column contains a link that removes (actually just archives by setting a bit flag) the row from being displayed in the "Active" view. If the user wants to see "Archived" rows, they would select it from the DropDownList and the page automatically posts and displays the archived items. But the last column with the link still appears. In this view, the "Remove" link is useless and somewhat unprofessional looking.
What I need help with is NOT showing that column when the SelectedIndex of the DropDown is == 1. If it is == 0 then I want the last column to show as normal.
I have tried "GridView.Columns.RemoveAt" which works the first time but doesn't show again.
So, is there anyway to hide a column on a postback and make if visible again.
Thanks in advance for any suggestions.
|
|
|
|
|
Sorry for the quick posting. I got it to work by:
if (blah blah)
{
GridView1.Column[4].Visible = false
}
else
{
true
}
Thanks anyway gang. Take care
|
|
|
|
|
This may seem like a very basic question but how to I get ASP.NET to authenticate based on the credentials provided in a .config file?
It's just for testing a site and when it's moved to production it will be in an SQL Database but whatever I do it tries to find an SQL database in ~/App_Data to load the authorization information from.
|
|
|
|
|
You probably have a sql-based membership provider configured in your web.config. Something like this:
<system.web>
...
<membership defaultProvider="xxx">
<providers>
<add name="xxx" type="System.Web.Security.SqlMembershipProvider" ... />
</providers>
</membership>
...
</system.web>
You will probably want to change the <membership> configuration to a different provider for your test environment.
|
|
|
|
|
Nope, that's the thing which is annoying me, the web.config is blank from providers but I looked through the assemblies in the Object Browser and couldn't see anything to change it to.
|
|
|
|
|
Hi,
On server side in form code behind class, I have a function
<AjaxPro.AjaxMethod()> _
Public Function test_get() As PROPREGLB.AssetQuerry
Dim v As PROPREGLB.AssetQuerry '
v = New PROPREGLB.AssetQuerry
v.AddNote("ASP.NET")
v.AddNote("2.0")
Return v
End Function
I call this function from my page javascript
function test()
{
var t;
debugger;
var retobj = AssetDataEntry.test_get();
}
when I debug retvalue,
I get retvalue as
__type "PROPREGLB.AssetQuerry, App_Code.hpedrzja, Version=1.0.5.31325, Culture=neutral, PublicKeyToken=null"
How to convert retval as the proper object of PROPREGLB.AssetQuerry
What kind of typecast has to be used.
I need to call methods available in
PROPREGLB.AssetQuerry class from the returned object in javascript also need to avail the existing data(inserted in the server side) in the javascript client side code.
any help will be highly apreciated.
regards
lee
Leya
|
|
|
|
|
Hey Guys
I want to display records from db having multilevel categories
ID, Name, Description, ParentID(ID of parent category).
I found many examples to show categories in heirarchical structure, BUT these are using Stored Procedures! Is there any efficient way to achieve this in C# ???
Thanks in Advance
Work Smart...
|
|
|
|
|
Hi All,
I have System.Xml.XmlDocument xmldc = new System.Xml.XmlDocument(); I am able to load values in to it from XML String.
Now I want to read these values in to DataSet object or DataTable object. But without writing it in to the file. By writing in to the file I can but I dont want to use it.
If you want we can write it in to XMLReader objet, shouldnt write in to the file, which is time consuming.
Any help is very usefull.
Thanks a Lot,
Aleem Mohammad.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Hi guys i having some probs ...,
Plz any one knows help me...,
On each monday one stored procedure have to run automatically...,
How can i do that?
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
I suggest you concentrate on one issue at a time.
|
|
|
|