473,769 Members | 8,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.net Using RenderControl on GridView raises form related exception

15 New Member
I have been struggling with this issue for some time, hope someone here can help out.

After facing the issue (will describe it soon) in a solution with Ajax and a Master Page I decided to try it in its most basic form: I created a new project, new aspx page with a GridView.

I notice that once I create the new page the body contains a <form runat="server"> tag.

I add a GridView, data comes from SQL server. I want to be able to render the GridView to HTML - in order to create a Print Preview page, containing, among other things, the grid view data. So basically I have

<body>
<form runat="server">

<asp:GridView > ... .. . .. . .</asp:GridView>

<asp:Button> ............... </asp:Button>
</form>
</body>

When I try to do RenderControl in the Button Click event I get an exception saying that the GridView must be placed in a <form runat="server"> tag.

When I try to wrap it inside this tag (i.e. <form runat="server"> <asp:GridView>. ...) I get an exception saying that the page can only have one server-side form tags.

Please help me out.
Frankie
Jan 29 '08 #1
2 4722
kenobewan
4,871 Recognized Expert Specialist
Have they also got a runat=server?
Jan 29 '08 #2
frankiefrank
15 New Member
Have they also got a runat=server?
Yes.

Just a moment ago - I managed to not get the exception after adding

Expand|Select|Wrap|Line Numbers
  1. public override void VerifyRenderingInServerForm(Control control)
  2. {
  3. }
  4.  
to my page. I'm sure I'll face some more trouble once i'm working with the master page... I'll write more if so.
Jan 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2000
by: norton | last post by:
Hi all. I have a question in using Request and Request.Form when the asp page is Request("txtName") i can use "testpage.aspx?txtName=User1" to post the value but when i use Request.Form("txtName") i cannot use that method,
4
13637
by: Carl | last post by:
When using 'name' in the form, it works, when using 'id' it doesn't. Any comments about this? By the way, is this a good method or is it better to use 'getElementById'? Carl <body> <form name="myform"> <input type button id="antw1" value="test"> </form>
1
2524
by: Abdul Mohsin | last post by:
is it possible to get hidden parameter values using window.opener.document.form.parameter.value. I am getting this error " Object not found" Please help Abdul
3
4270
by: Andres Romero | last post by:
I have a button in my html page for exporting to excel files using the RenderControl function. When the table generated is small in rows size it works fine, but when there are much more rows (more than 5000) the excel loss format in the last rows mainly in Rowsan or Colspan property for the table. This is the code I'm using Response.Clear(); Response.Buffer=true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "";
1
1362
by: =?Utf-8?B?U21pdGE=?= | last post by:
I have a gridview, and a listbox which has a different datasource. The listbox contains distinct types of contacts, whereas the gridview will get populated upon contact type selection. The data is displayed but when on submission of the contact type from the list box i get a null reference exception. I already tried to trap using SelectedIndex -1 but that does not work.. Any pointers.
10
39412
jamjar
by: jamjar | last post by:
How do I change the form view using VB after the form is opened? I am using the Switchboard pretty much as the wizard loads it. I've tweaked the appearance and a couple of lines of code but I don't want to modify it too much. When I try to load a form with the properties set to load as Datasheet view only, the switchboard's VB code overrides these settings and loads it in Form view. Can I use VB in the Form_Open or some other event to...
5
3187
by: rajdevramasamy | last post by:
Hi, In my webpage, i am adding my user control using rendercontrol() using the following code: Dim NumericEditControl As New Control NumericEditControl = LoadControl("Controls\NumericEdit.ascx") Dim sb As New StringBuilder() Dim sw As New StringWriter(sb) Dim htw As New HtmlTextWriter(sw)
0
1310
by: liamacheung | last post by:
Hi, I am designing a GUI application using a VC++ 2005 Form template. I have created a thread function external to the class containing the form. I can successfully create the thread and run operations in the thread function, but I want to be able to call member functions in the Form from the thread process. In order to do this, I plan on passing a pointer to the object (i.e. the form) as one of the CreateThread parameters. My...
0
1135
by: wagswvu | last post by:
I am writing a User Control in C# that dynamically generates some text boxes and two buttons. For all the html on the page I am overriding the render method, I also render my Button/Textbox controls as well using the “.RenderControl”. However, when I do that I can’t seem to get my button click events to work. protected void LoadSearchButtons(HtmlTextWriter htmlWriter) { searchButton = new Button(); ...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.