CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 7/21/2005 12:24:47 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 238 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
FatMooseHenry
Asp.Net User
Masterpage and file upload - form problem7/21/2005 12:24:47 PM

0

I have a masterpage with a menu (sitemap), and therefore it needs a <form runat="server">. I am now making a page that uses this masterpage, and this page should be able to uploade files and now i need a <form id="Form1" method="post" runat="server" enctype="multipart/form-data"> form, but asp.net 2.0 can not contain two forms on one page.

Cant i have a upload form on a page that uses the masterpage above?
MorningZ
Asp.Net User
just an idea7/21/2005 2:16:08 PM

0

and i see absolutely no idea why this wouldn't work

- use the "FindControl" method from your aspx to find and grab the <form> control from the master
- add the "enctype" property to it
"If you make it idiot proof, they'll build a better idiot"
MorningZ
Asp.Net User
Re: just an idea7/22/2005 2:48:49 PM

1

Here's some code as i just had to do something similar today....   so inside the aspx page i used FindControl to access the <form> tag and set the Enctype...  so now this page is ready for file upload, any other page is just a normal form

Dim frm As HtmlControls.HtmlForm
frm =
CType(Me.Master.FindControl("aspnetForm"), HtmlControls.HtmlForm)
frm.Enctype =
"multipart/form-data"


hope it helps

 


"If you make it idiot proof, they'll build a better idiot"
FatMooseHenry
Asp.Net User
Re: just an idea7/24/2005 4:26:23 PM

-1

Ive tried: (C#)

System.Web.UI.HtmlControls.HtmlForm frm = new System.Web.UI.HtmlControls.HtmlForm();

frm = (System.Web.UI.HtmlControls.HtmlForm) Parent.FindControl("myForm");

frm.Enctype = "multipart/form-data";


It cant find "myForm", i must be pointing wrong...do you know whats it is called, if its not Parent.Find...

have the masterpage, and a site with code-behind

MorningZ
Asp.Net User
its not "new"7/24/2005 10:55:40 PM

-1

sorry, don't know the correct C# syntax, but do not use the "New" designation on the declaration of "frm", as you are not creating am instance of the Html Form tag, you are going to be referencing an existing one

also, use  "Master.FindControl", not "Parent.FindControl", that for sure will goto the Master (as there might be situations where "Parent" won't)

I promise this works, i have this exact code working 100% on a live site right now


"If you make it idiot proof, they'll build a better idiot"
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning SharePoint 2007: building team solutions with Moss 2007 Authors: Amanda Murphy, Shane Perran, Pages: 552, Published: 2007
Microsoft Sharepoint: Building Office 2007 Solutions in VB 2005 Authors: Scot P. Hillier, Pages: 519, Published: 2007
Microsoft Expression Web 2 on Demand Authors: Steve Johnson, PERSPECTION INC., Pages: 429, Published: 2008
Macromedia Dreamweaver MX advanced for Windows and Macintosh Authors: J. Tarin Towers, Abie Hadjitarkhani, Sasha Magee, Pages: 490, Published: 2002
Beginning ASP.NET 2.0 with C# Authors: Chris Hart, John Kauffman, Pages: 760, Published: 2006

Web:
CodeProject: FileUpload with Master Page, Ajax Update Panel ... May 23, 2008 ... I'm writing this article after finding a solution to a problem ... I was using Form View control to insert-update & show data, and for ADO. ..... I am using Fileupload control in my masterpage for Ajax web application. ...
Fileupload Control is not working with MASTERPAGES - ASP.NET Forums i have a problem here , i have a page with FileUpload Control and ... the asp: button on my form to upload the file I find that the HasFile ...
Problems with file upload control : asp.net 3.5, MasterPage, Form ... Apr 10, 2009 ... I am struggling to get this working and it should be pretty straight forward. I am using a masterpage with a form tag on it.
CodeProject: FileUpload with Master Page, Ajax Update Panel ... May 23, 2008 ... I was using Form View control to insert-update & show data, and for ADO. ... The problem was as follows: Ajax does not support File upload ...
Poblem with File Upload control in master page when i integrate this page with master page that code is not working.help me how can i solve this problem. protected void btnNumber_Click(object ... I think you are trying to create file upload control dynamically. ...

Masterpage and file upload - form problem - ng.asp-net-forum ... Masterpage and file upload - form problem, > ROOT > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls, ...
using form.findcontrol in a masterpage - ng.asp-net-forum ... Masterpage and file upload - form problem - ng.asp-net-forum ... Cant i have a upload form on a page that uses the masterpage above? ...
Master with UpdatePanel + Content with FileUpload - ng.asp-net ... Masterpage and file upload - form problem - ng.asp-net-forum ... CodeProject: FileUpload with Master Page, Ajax Update Panel . ... in Master page , but file ...
One Web.sitemap for multiple SiteMapDataSource / Menus - ng.asp ... Masterpage and file upload - form problem - ng.asp-net-forum ... how to have a webpage url 'auto-fill' a contentplaceholder? directory ...






master pages do not display content immediately

ugly masterpage markup fix?

menu control with sitemapdatasource not firing menuitemclick

why is my page title not working?

how to put focus on textarea in content page?

using master pages + content pages + pagebase

menu navigation

master page ddl to control content page gridview

treeview1.node.checked=true......?????

can't get imagurl from treeview node

controls for flash movies

the contentplaceholder is too small to add several controls

help! treeview showlines problem!

startingnodeoffset: why doesn't positive offsets work?

looking for a component. thank you.

gridview column sorting in codebehind

howto register a clientscript in a page using nested masterpage

masterpages & stylesheets

context menu in datagrid

question about reusing controls

no expandedimageurl property for system.web.ui.webcontrols.treenode in .net framework 2.0?

rollover problem

treeview postback problem

treeview help!!

no default member found for type 'guid'

treeview - remove tooltip

get seletected node from a treeview with javascript

treeview issue

subclassing treenode

tree view page getting refreshed on checking last node

   
  Privacy | Contact Us
All Times Are GMT