|
Hi,
I have a list box in which i am populating with filenames i.e. attachments. On click of the filenames i want to open the file.
Is there any was in which i can do this? i want the text in the list box to be linkable which will open the corresponding files.
Can anyone suggest me a way of doing this?
It's very urgent.
Thanks,
Riz
|
|
|
|
|
Set the listbox autopostback property to true.
Write the logic in the SelectedIndex Changed event of the listbox.
As you are displaying the name of the attachment(or) path of the attachement, on selection changed identify the selected item and redirect the page to the new path!!
Gautham
|
|
|
|
|
Thansk for ur response
I am saving the entire path along with the file name in the listbox.
On selected index change i am getting the selected item i.e: "D:\GoldshieldProjects\TestApp\Attachment\Attachment1.txt"
Now on click of this item want to open this file in a new window.
Do u knw how can i dopen this file?
Thanks,
Riz
|
|
|
|
|
Riz,
Try the following code:
StreamReader sr = new StreamReader("path of the attachment");
sr.ReadToEnd();
This sr.readtoend can be assigned to a label or a multiline textbox in your page so that the file can be viewed in that control
Make sure you are using Systems.IO namespace
Gautham
|
|
|
|
|
I want to open the file in a new window. The code which u have given will assign the contents of the file to a textbox or a label.
I want to open the stored file. i.e. i want to view the file.
Is there any other way to do it?
regards,
Riz
|
|
|
|
|
Riz,
The other way that iam aware is that you got to save a copy of all your attachments in your application folder.
I mean the file in the D:drive should be in your App Folder, in that case you can simply give Response.Redirect("path of the file in app folder");
This way you can view the file in a new window!
Other way around is place the label / text box in a seperate form and view that form on clicking the listbox!!!!
Gautham
|
|
|
|
|
You can open any document using his code
<br />
System.Diagnostics.Process process = new System.Diagnostics.Process();<br />
process.StartInfo.FileName = @"C:\logs\Current.Txt";<br />
process.Start();<br />
But for new Wondow i think you will have to use Browser object or clent side code
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Dear
I am facing a problem in publishing my portal that is developed in asp.net 2.0. my portal has arount 15 folders in which total i hv 150 pages including html and aspx .now if i do any little change in any of single page I will have to publish the whole website again coz of that dll has been changed......So plz help me by giving me solution so that i don't need to publish the whole site only i can publish single page or folder.....
THANKS IN ADVANCE BUT PLZZ SOLVE IT...
Nishu Mahendra
Nishu Mahendra
Sr. Executive Web & Development
|
|
|
|
|
If you're in ASP.NET 2.0, you should just be able to replace the pages you changed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
But if I add some more function into code behined.
How will replace it.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Hi all
Iam working on a page which will play Quick time / Flash files
But i want to know is the client system have the Flash / Quick Time players
if not I want to display information for client
How can i do this any ideas
Keerthi
|
|
|
|
|
I am new for ASP.NET
I had developed an leave application, for a company.
Now i have to deploy it, so i made a installer with Web page setup, but i dont know how to specify the URL to call the application at the server once installed.
Can any one tell me how to do it? (OR)
Is there any other way to deploy the application(Simple or Complex)
-------------------------------
And what are the requirements at the server to install the application.
The server operating system is Windows 2003 server Standard edition - 32 bit.
I had installed .NET framework and IIS 6.0
Is there any thing else and Should i have to configure any thing at the server.
Can any one plese help me with the process.
Plz.... Help
Jats
|
|
|
|
|
I don't understand why: When I log out, all image in my page (master page section) disappear ???
All image appear when I logged in!
Please help me, thanks and best regard
|
|
|
|
|
Before Building your application to see in the Browser ie., IE or Mozilla first clear all the cookies and the Browsing History and then build your application.
Regards,
Satips.
|
|
|
|
|
Exclude the image folder from Authentication using following tag in web.config file.
<location path="Images">
<system.web>
<authorization>
<alow users="*" />
</authorization>
</system.web>
</location>
</configuration>
Regards,
Prakash Kalakoti
|
|
|
|
|
|
How can I prevent the user from again logging in by clicking the back button. In my web application, after signing out, if the user clicks on browser back button, he can access the main page again.
|
|
|
|
|
Try with the Session. If the User sign out close the Session.
Regards,
Satips.
|
|
|
|
|
It's depend on your implementation.
* If u save the login credential in session or cookies. Then can set the nothing for the Session variable and clear the cookies.
*If u r varify login information only first time when user logged in then u can disable back button by bellow code.
U can use below code. This will not be cach any page on loca machine. then i think it should be work as disable back button.
If u have other problem let me inform.
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
You should not block the back button of the browser using some javascript. In every page load check that the session exist. If not redirect user to login page. When logging out clear the session. By pressing the back button you are seeing the browser cached page. If you are checking sessions on page load, user can't do any processing with the page. When the page posts back, it will check for session and will be redirected to login page.
|
|
|
|
|
Thank you very much for the quick response, I will try your suggestion.
|
|
|
|
|
u can use this script in ur last page ..
history.forward();
so back option vl not work
|
|
|
|
|
|
sorry I didnt think abt it..do u have any solution???
|
|
|
|
|
Whatever solution you suggested is not good, I given the solution on the previous message
|
|
|
|