How To Have 2 Forms In A Page / Submit Form And Get Results To Display
Jan 31, 2011
I have a simple .net form with two input boxes to choose the event and location. On button click, an xml url is built and this xml file is read using ReadXml, dataset is built and the results are displayed in the same page. I have both the forms to run at server and it says I cannot have it.
I have a web form called default.aspx which has a form with user information. In addition to this, I have an iFrame on the same page that displays a page Secondary-Form.aspx that has a few additional dynamic data fields. I need to do two things.
1. I need to pass the parent form data in real time to the iFrame page to refresh its content and modify it's fields accordingly. Example: If the user submits their Vehicle Choice as Car on parent form, the form item in iFrame will display a radio button that says Honda, and if the user submits their Vehicle Choice as MotorCycle in the parent page, the iFrame will display Harley Davidson as the radio button choice
2. The submit button is on the parent page. I want both pieces of this information (from the parent page, as well as iFrame selection) to be passed to a server side ASPX page to process this information.the default.aspx and Secondary-Form.aspx files are located on different domains.
i have an html editor where a user can put in some text.the thing is that when trying to display this text on a different page results in displaying the html that was saved by the editor.i want to display the text in a text box (if possible), with the special attributes(bold, itali etc.i currently get the text with the html tags.
I have a datalist and want the results paged I have written a pager.ascx page and have an aspx and aspx.cs page to display the results. I have a stored procedure to pull the data out of the database and a class to talk between the stored procedure and presentation controls I have the pager being displayed when the results get over the limit I have set to 10 in the web.config file but when i click on the next link to display the next page of results it doesn't do anything. my aspx page is
<uc1:Pager ID="topPager" runat="server" Visible="False" /> <asp:DataList ID="newsList" runat="server" CssClass="List" align="center"> <ItemStyle CssClass="ItemList" /> <ItemTemplate> <h2><%# Eval("Title") %></h2> <p>Posted <%# Eval("Date") %></p> <p><%# Eval("News").ToString().Replace(" ", "<br />") %></p> </ItemTemplate> </asp:DataList> <uc1:Pager ID="bottomPager" runat="server" Visible="False" /> my aspx.cs page is protected void Page_Load(object sender, EventArgs e) { // Retreive page from the query string string page = Request.QueryString["Page"]; if (page == null) page = "1"; // How many pages of posts int howManyPages = 1; // pager links format string firstPageUrl = ""; string pagerFormat = ""; //DataAccess.GetNews returns a DataTable object containing news data which is read into datalist newsList.DataSource = DataAccess.GetNews(page, out howManyPages); // Bind the data to the data source newsList.DataBind(); // have the current page as interger int currentPage = Int32.Parse(page); // Display pager controls topPager.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, false); bottomPager.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, true); } my pager.ascx page is <p> Page <asp:Label ID="currentPagelabel" runat="server" /> of <asp:Label ID="howManyPageLabel" runat="server" /> | <asp:HyperLink ID="previousLink" runat="server">Previous</asp:HyperLink> <asp:Repeater ID="pagesRepeater" runat="server"> <ItemTemplate> <asp:HyperLink ID="hyperlink" runat="server" Text='<%# Eval("Page") %>' NavigateUrl='<%# Eval("Url") %>' /> </ItemTemplate> </asp:Repeater> <asp:HyperLink ID="nextLink" runat="server">Next</asp:HyperLink> </p> my pager.aspx.cs page is using System; // Simple struct that represents a (page number, url) association public struct PageUrl { private string page; private string url; // Page property definition public string Page { get { return page; } } // Url property definition public string Url { get { return url; } } // Constructor public PageUrl(string page, string url) { this.page = page; this.url = url; } } // The pager control public partial class UserControls_Pager : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } // Show the pager public void Show(int currentPage, int howManyPages, string firstPageUrl, string pageUrlFormat, bool showPages) { // Display paging controls if (howManyPages > 1) { // make the pager visable this.Visible = true; // Display the current page currentPagelabel.Text = currentPage.ToString(); howManyPageLabel.Text = howManyPages.ToString(); // Create the Previous link if (currentPage == 1) { previousLink.Enabled = false; } else { previousLink.NavigateUrl = (currentPage == 2) ? firstPageUrl : String.Format(pageUrlFormat, currentPage - 1); } // Create the Next link if (currentPage == howManyPages) { nextLink.Enabled = false; } else { nextLink.NavigateUrl = String.Format(pageUrlFormat, currentPage + 1); } // Create the page links if (showPages) { // The list of pages and their URLs as an array PageUrl[] pages = new PageUrl[howManyPages]; // Generate (page, url) elements pages[0] = new PageUrl("1", firstPageUrl); for (int i = 2; i <= howManyPages; i++) { pages[i - 1] = new PageUrl(i.ToString(), String.Format(pageUrlFormat, i)); } // Do not generate a link for current page pages[currentPage - 1] = new PageUrl((currentPage).ToString(), ""); // Feed the pages to the repeater pagesRepeater.DataSource = pages; pagesRepeater.DataBind(); } } } } my class file is // Retreive the list of news posts public static DataTable GetNews(string pageNumber, out int howManyPages) { // Get a configured DbCommand object DbCommand comm = GenericDataAccess.CreateCommand(); // Set the stored procedure name comm.CommandText = "GetNews"; // create a new parameter for page number DbParameter param = comm.CreateParameter(); param.ParameterName = "@PageNumber"; param.Value = pageNumber; param.DbType = DbType.Int32; comm.Parameters.Add(param); // create a new parameter for products per page param = comm.CreateParameter(); param.ParameterName = "@PostsPerPage"; param.Value = PlatiumMindProductionsConfiguration.PostsPerPage; param.DbType = DbType.Int32; comm.Parameters.Add(param); param = comm.CreateParameter(); param.ParameterName = "@HowManyPosts"; param.Direction = ParameterDirection.Output; param.DbType = DbType.Int32; comm.Parameters.Add(param); // Execute the stored procedure and saven the results in a DataTable DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); // Calculate how many pages of posts and set the out parameter int howManyPosts = Int32.Parse(comm.Parameters["@HowManyPosts"].Value.ToString()); howManyPages = (int)Math.Ceiling((double)howManyPosts / (double)PlatiumMindProductionsConfiguration.PostsPerPage); // return the page of posts return table; } my stored procedure is ALTER PROCEDURE [dbo].[GetNews] (@PageNumber INT, @PostsPerPage INT, @HowManyPosts INT OUTPUT) AS -- Declare a new table DECLARE @News TABLE (RowNumber INT, NewsID INT, Title NVARCHAR(50), Date DATETIME, News NVARCHAR(MAX)) -- Populate the table with the complete list INSERT INTO @News SELECT ROW_NUMBER() OVER (ORDER BY NewsID desc), NewsID, Title, Date, News FROM News -- return the total number of posts SELECT @HowManyPosts = COUNT(NewsID) FROM News -- extract the request page of posts SELECT NewsID, Title, DATE, News FROM @News WHERE RowNumber > (@PageNumber - 1) * @PostsPerPage AND RowNumber <= @PageNumber * @PostsPerPage
To this Redirect.aspx page, I'm directed from some external page. In the request context, I have APP_ID key, which is passed from this external page. Next, I want to pass this APP_ID value using POST to some other page, which is defined in the configuration. Unfortunately, I'm getting such error while redirecting:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I don't want to disable view state validation (<pages enableViewStateMac="false">) because this is not the "solution" I want to apply.
Besides I don't understand why I'm getting such an error. Can someone get me through this ? Is there any other way to automatically submit a form on Page_Load event ?
I'm developing a search page that will display the results in a gridview. The codebehind (in VB.NET) uses a SQL command to fill the gridview.
The gridview does have paging and sorting enabled. Once the search button is clicked the initial results are displayed, if the user clicks on a sorted column or wants to advance a page the gridview disappears. Enable Sorting And Paging Callbacks is set to True. Enable ViewState is also set to True.
I am trying to develop a page where I am trying to search a database (MyQSL) and display the data in a table format. Some of the database entries, like category, is stored as integer values, but I want to display the category name in the search result (not the corresponding integer value). I have also another issue, every time I change the dropdown list values (which are having "auto postback" enabled) the <EmptyDataTemplate> is returned. At this moment I am using GridView. But I am ready to change this to any other method, like repeater or whatever...
Not sure if this is for SQL or .net! I have 3 tables which looks like
table1 ID Name 1 Jon
and
table2 ID Number Job 1 1 IT 2 1 Web 3 1 Admin
table1 ID ContractType 1 Temp 1 Perm
An inner join makes one table with 3 rows (I excluding the ID from table 2 for the join) which is saved as a view
viewTable ID Name Number Job ContractType 1 Jon 1 IT Temp 2 Jon 1 Web Temp 3 Jon 1 Admin Temp 4 Jon 1 IT Perm 5 Jon 1 Web Perm 6 Jon 1 Admin Perm
I want to display these results on a web page via the grid view. However, I don't want to show the user 6 times! I want to show the user name once, the contract type once and each Job! What is the best way to do this? Is there a fault with the database design already? I assume the easiest answer is to not join them in a view but query each section 3 times from the website but I'd rather 1 connection only!
i have post detail page (asp.net, umbraco cms), with search box and post replay box.the problem is that when user try to search using the search box, it cause validation error in the post replay box.the search is client side form.the post replay is server side form.you can view it live at:[URL]
I have two asp.net applications webapp1 and webapp2, in each application i have a asp.net form Deafult.aspx
I want to do a form submit from Default.aspx in webapp1 and recieve the value in webapp2.
I tried to do it with simply setting action ="webapp2 location" but it is throwing the bellow error
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I even added the machinekey element to web.config
but it is still showing the same error.
This is the code for webapp1 form which sends data to webapp2
Hardware involved: SQL Server 2000 Microsoft Server 2003 with IIS6 [code]...
The goal, from internal department (user) perspective:A department wants to "upload" an excel spreadsheet of data (product, term, rate, etc) to SQL (this will be from the internal network). The data is then saved to a webpage location for that department to view and approve. Once "approved," this data is displayed on the live web servers (public-facing website which is two load balancing servers). Bonus:
The .NET application/SQL Server can send an email to the department reminding them to upload the latest rates (each weekday morning, then each Thursday afternoon) if rates have not yet been "approved."
From the development perspective, this is my general idea, but I may be wrong.There are three spreadsheets, each with one tab. The first spreadsheet is uploaded, and the .NET application puts it in a SQL table. I then need to display this table of data on a .aspx page for the department to approve before the .aspx page is pushed to the live web servers.
First, I need an interface for this department to upload Excel files. I need this application to save the data to SQL and display it in a .aspx page so that the department can look it over and approve it. The department needs a way to "approve" the page, and this action will push the data to the live web servers. Will this involve SQL data transformation services?
This post is related to the issue of using javascript with asp.net form found here:[URL]I figured out that the issue I am having is not that the javascript cannot find the control but rather that the ajax frame I am using, for some reason does not allow me to find the controls.Here is how I submit my form in VS 2008 which is working fine:
<form id="form1" runat="server" target="ajaxFrame" defaultfocus="userName"> The ajax frame below, is on the login page right before the body closing tag: <iframe id="ajaxFrame" name="ajaxFrame" src="" style="visibility:hidden;"></iframe>
When the user clicks the login button, all the vb.net code on the code behind page is executed and some hidden fields are populated with some login/user validation data. The iframe then takes the user name and password (using jquery and some custom javascript) and automatically redirects and login the user on another website where an asp/js login page is used.For some reason, this exact setup does not work with asp.net 4.0.
I've been trying to figure this out all afternoon but my google-fu seems to be failing me. I'm setting up a page with a fairly large form, which has one field that is going to require some kind of popup page that will allow the user to perform a lookup.
At the moment I'm only prototyping the page so I'm actually only attempting to a the button up to fire an alert when the button is clicked instead of generating a lookup screen. However it seems that no matter what I do the button causes the form to submit.
I remember one of the very first ASP .NET beginner videos I ever watched went through configuring a button to perform actions without submitting, but I can't seem to figure out which one it was.
I want to stop the form submit, i mean i want the control to stop or proceed i am using validation control,if validation contrrol is satifies it will submit the form, i want even if the valdation control satifies its condidtion , i want stop or control the form submission through javascript or server-side any how
if I need to design an online form , which from the bginning to the final submit have a few step of next allow back and the just imput is not lost( inside the session)
I am new to page building and have run into a roadblock. I am using Microsoft Expression Web 3.
I am seeking to enabling a form button to submit the data within user-entered fields to my email address. I am seeking to deliver results to a POP account.
Here is my current Form code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Page Language="C#" %> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> runat="server">
I have a contact form inside of an update panel so I don't get the page flicker. Once the form passes validation and the email sends, how do I automatically clear the text boxes?
I'm using a ASP.NET Web Form to capture information from a user and then email the results to me. This is working well.
The problem is, that the SMTP Relay Server I am using from my ISP seems to be a bit slow so once I hit SEND on the form, it seems to take a little longer than average before sending the user through to the "Thank-You" page.
To counter-act the long wait time, I would like to add a little bit of code that will display on the Web Form once the user clicks the send button, but before the data is actually sent or they are forwarded on to the thank-you page.
Right now in my file.aspx.vb I have:
Try smtpClient.Send(mailMessage) Response.Redirect("thankyou.aspx") Catch smtpExc As System.Net.Mail.SmtpException 'Log error information on which email failed. Catch ex As Exception 'Log general errors End Try
What I'm wondering is if it is possible to have a HIDDEN control of some type on the form and then change Visible=False to Visible=True to have the text display once the user clicks the Send button? Or should this be done another way?
I have the windows form user control with the name usercontrol.cs .. I want to display this usercontrol.cs in aspx page..I tried the below code..but it produced error.. how to resolve my proplem...thx
Control MyUserControl; MyUserControl = LoadControl("usercontrol.cs"); MyPlaceHolder.Controls.Add(MyUserControl);
I have tried various techniques that some seemed to have outlined and so far none of them have worked. I have a situation where the Page_Load() needs to build a set of <input id=<dynamic name'>> that are build dynamically inside a <ul>. The form gets created fine but when I click the button and look at the results returned to the server I cannot seem to find the input values. Is there a defined way of accomplishing this?
Using .Net framework 4.0I have a .net search application that reads values from regular html webforms submitted via the Post method. So the code to process these forms uses Request.form and looks like
[Code]....
I am writing a new .net application that needs to call this same search application.