.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

2 buttons, 1 form, 1 error

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net


Ok, newbie question here...

I have a form with two submit buttons, each required to fire a different event.

Basically the form loads, some data is input by the user, and the first submit button is clicked. The btnSubmit.OnClick event runs and if it meets some condition, a gridview is displayed, and user is asked to confirm their selection before proceding. That's when btnConfirm.OnClick needs to run.

But it won't compile and I get the error...

error BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Validation Complete

I don't particularly want to post to another page - I'd like to keep it all on a single page.

Any ideas?



View Complete Post

More Related Resource Links

single form multiple buttons in MVC


In a single page  has two buttons , ddown and tempname.

I wrote two actionresult separetly each one for ddown and tempname.

I need one is post and another one is get method. so i gave like

1. Get Method


        [AcceptParameter(Name = "button", Value = "tempname")]
        public ActionResult ddown_tempname(string statusName, NewsLetterAdminViewModel viewModel)

return View();



2.Post Method


        [AcceptParameter(Name = "button", Value = "ddown")]
        public ActionResult ddown(string statusName, string button, NewsLetterAdminViewModel viewModel, FormCollection collection)

return View();



if i call the post method its worked well. but if i call the get method, the code does not execute. the brea

Error when opening Infopath Form


Background: Created an Infopath 2003 form with 2 views (1 as Read-Only View and another 1 for Submitting content) and published to a Sharepoint 2007 Library.

Working: When a user opens a new form it opens in submit view; once the form has been submitted, when the user tries to open again, the form opens in read-only view.

Error: 99% of the users do not face any issues, however when the the rest 1% of the users try to open a new form; they receive the following error and are unable to open the form.

Form template: _http://server/sites/subsite/library/forms/template.xsn
InfoPath cannot open the following view: Edit_View
The following view file is not valid: view1.xsl
The file is not a valid XML document.

An invalid character was found in text content.

Line 673, Position 12

I am not sure what is wrong here (or) from where this error is being generated!

Balaji Baskar [Please mark the post as answer if it answers your question]

Attachment upload error on browser based InfoPath form



I am having an interesting problem with browser based InfoPath forms in SharePoint 2007.  For some reason the file attachment control is not working any more.  It was working fine in July, but now it will not allow file attachments over a few kb.  I tried a 34KB file and I get the error below, a 2KB file works fine.

Unable to connect to SQL Server session database. The connection string (server='SPDB', database='SharedServices1_DB') was returned by an instance of the IPartitionResolver type 'Microsoft.Office.Server.Administration.SqlSessionStateResolver, Microsoft.Office.Server, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.   at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)
   at System.Web.SessionState.SqlSessionStateStore.HandleInsertException(SqlConnection conn, Exception e, Boolean newItem, String id)
   at System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
   at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEven

Calculated Columns in a Form Library receive error: Value does not fall within the expected range.


I have a forms library that posts the date the form was created. We would like to create a calculated column that allows us to look at these forms based on the month and year they were created. I had created a calculated column that extracts the month and replaces the number with a text string by using an if statement; "IF(MONTH([Proposal Date])=1,"January","") It goes on to evaluate each month and replace the number with the text string. This formula worked for quite some time, though now when I try to add any calculated columns or edit any existing calculated columns on this form library I receive the following error: Value does not fall within the expected range. Now my existing calculated columns (like the one above) do not work and I can not create new calcualted columns. Any insight would be awesome as this has been plaguing me for a couple of months now.

Infopath form - browser error client error


I am facing a problem with browser enabled infopath form. I have developed this in infopath 2007. I have few fields in a repeating table. It contains Number of units, qty , subtotal and total. Total is sum of all sub totals and Sub total is  multiplication of units and qty. I am able to insert new items in preview and getting subtotal and total. I have published it in sharepiont as browser enabled form as a content type. When I opened the form in browser and insert new item in repeating table then I am not getting my subtotal and total updated. I am getting those for only first row. other rows are not working. This is working with infopath client.  Please help me out..



center two buttons horizontally in form in C#

I have two buttons that are side by side. I want to center them such that they are equal distance from the left and right sides of the form. I want to do this at design time. This was easy to do in VB6. Not sure how to do this in C#.  If this isn't easily done at design time, how do I do this at runtime?      

error in MVC2 on empty string form fields which are required: "This property cannot be set to a null

In model I have:[DisplayName("ISBN")] [Required(ErrorMessage = "ISBN is required.")] [StringLength(50, ErrorMessage = "ISBN book must have max {1} chars.")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string isbn { get; set; }But when I submit form with empty field ISBN I have an error - ConstraintException: This property cannot be set to a null value.I have find that other people have the same problem and they say that debbugger in VS2010 works wrong - yes ?http://p2p.wrox.com/book-professional-asp-net-mvc-2/79788-constraintexception-unhandled-user-code.html#post259245http://efreedom.com/Question/1-3129080/Server-Side-Validation-REQUIRED-String-Property-MVC2-Entity-Framework-Workhttp://mvcmusicstore.codeplex.com/workitem/6604

Error when activating Infopath form deployed as a feature

I've packaged a form as a feature and created the appropriate WSP file for it.  i then deployed this feature to a target system using the following commands: @SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM" @ECHO OFF ECHO Retract Solution %STSADM% -o retractsolution -n "Crown.SharePoint.CAPEXForm.wsp" -immediate ECHO ====== %STSADM% -o execadmsvcjobs ECHO Remove Solution %STSADM% -o deletesolution -n "Crown.SharePoint.CAPEXForm.wsp" -override ECHO ====== %STSADM% -o execadmsvcjobs ECHO Adding Solution %STSADM% -o addsolution -f "Crown.SharePoint.CAPEXForm.wsp" ECHO ====== %STSADM% -o execadmsvcjobs ECHO Deploying Solution %STSADM% -o deploysolution -n "Crown.SharePoint.CAPEXForm.wsp" -immediate -allowgacdeployment -force ECHO ====== %STSADM% -o execadmsvcjobs The deployment process completes without errors, and when I check under Central Admin > Solution Mgmt, my feature is there and shows as "Deployed/Globally Deployed".  So all looks good at this time. However, when I go to the Site Collection and try to activate the feature I get this error -- any ideas what may be going on here or what I'm missing? Feature '25f5615f-b338-48ff-8eb7-2ba05dd9972c' could not be installed because the loading of event receiver assembly "Microsoft.Office.InfoPath.Server

InfoPath Form: Encountered error while trying to submit the form from the browser

Hi,I have created a form in InfoPath, and i filled in the form in the browser. But there's an error apppeared when i tried to click on the submit button to submit the form. May i know is there ways for me to check what cause this error because i have no idea about this. "There has been an error while processing the form. There is an unclosed literal string. Line 1, position 543. System.Xml.XmlException: There is an unclosed literal string. Line 1, position 543. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at Microsoft.Office.InfoPath.Server.Xml.InfoPathXmlDocument.Load(XmlReader reader) at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObject.<>c__DisplayClass3.<.ctor>b__0() at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.Exception

Infopath form and forms library error

I've created an InfoPath 2010 form and associated it with a forms library on a SharePoint site. When I go to the library and choose "Add document" the form opens up to be filled out by the user. When the form is filled out, and the user tries to submit, they get an error saying that I need to configure SharePoint to allow cross-domain data access for user form templates that use connection settings in a data connection file and store a UDC file in the same site collection as the form. So I've enabled cross-domain data access and I've already created a Data Collection Library for Forms in the Site that is approved. What am I missing?  Why am I still getting the error?  

Error opening an Infopath form

I am trying to open an Infopath xsn form and I get the following error - "infopath cannot load this form. Either the signature is corrupted, or the certificate used to sign this form is expired or revoked. Contact the author of the form." I am the author of the form. I tried calling my cellphone number but there was not answer. Anyway, I've encountered this error before and I ended up redoing the form from scratch. I don't want to do that obviously. Is there a way to open the form somehow?Thanks,Dave

Confirmation buttons in a form.

Hi, I'm looking to change the destination of the browser when it is re-directed by an OK or CANCEL button in a form - e.g. I need the browser to re-direct to a page with a document list rather than a home page. Thanks

Invalid URL error on InfoPath Form Publish on an External List

I am using SP2010 Enterprise on Windows 7 and SPD 2010 & InfoPath 2010 all on the same machine in test.  I create an External List based on a ECT and Click on the 'Design Forms in InfoPath' icon and 'Item' which drops down from it.  That launches InfoPath Designer 2010 & downloads the form from http://<site>/lists/<mylistname>/Item/template.xsn and sets you up in an edit session.  I can make changes on the form but when I publish via File | Publish | External List (Publish Form To An External List) I get a save prompt for local copy & then an error: The following URL is not valid: http://<site>/lists/<mylistname>/Item/template.xsn  (same URL as it started with during the initial download). I took screen shots of the messages to make sure. Some things I have tried & observations: If I change to an internal Custom List the publish step (to list not external of course) works just fine. I also ran this test launching SPD as Administrator with no difference.  I stopped the System Event Notification service per http://serena-yeoh.blogspot.com/2006/08/infopathformurlnotvalid.html  'net stop sens' with no difference Any ideas are welcome. BTW I notice that this step of launching the InfoPath designer does change the form on the list in Sharepoint albeit slightly -

The URL is not valid error while publishing InfoPath form to MOSS 2007 server

Hi All,   When I try to publish the form onto a SharePoint Team site it throws the error: The following URL is not valid : http://tcs037288:6543/sites/projectmanagement   I have checked the comaptibility, trust and everything looks fine. Also, I tried to upload this template from Central Admin but there it is failing with browser-compatibility errors.       Regards,

Form validation error

When i try and submit a form..this is the error i get "The form cannot be submitted because it contains validation errors. Errors are marked with a red asterisk (required fields) or a red, dashed border (invalid values)." But i cannot see any red dotted lines and all the required fields are populated as well. When i submit my form in preview mode of Infopath: this is the error i am getting: The form contains the following errors: Field or group: Value Error: Only positive integers allowed Please help and let me know if I am missing on anything here?

Error submitting browser enabled form using this.Submit()

I'm trying to submit my Infopath form by calling this.Submit() method from my button click event handler.  According to Microsoft - Note: You can write a custom submit event handler for the Submit event, and then you can programmatically call the event handler by using the Submit method. This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser. Its not working for me and throws this exception  - XmlForm.Submit cannot be called from the SubmitEventHandler. BTW - I'm able to submit same form without any problem if I don't use this "Submit()" method.  I really want to know why its behaving like this.  Looks like a BUG.  Thanks, Suhaib Khan

save codes error in form view tool

hi i use this code in form view(at INSERT button)  for save data into SQL serverInsertCommand="INSERT INTO Debtor (AccNo, CompanyName, Desc2, RegisterNo, Address1, Address2, Address3, Address4, PostCode, AreaCode, Phone1, Phone2, Fax1, Fax2, NatureOfBusiness, WebURL, EmailAddress, DeliverAddr1, DeliverAddr2, DeliverAddr3, DeliverAddr4, DeliverPostcode, Attention, SalesAgent, DebtorType, DisplayTerm, CreditLimit, CurrencyCode, UDF_Shipvia, UDF_freigh, UDF_SourceIn, UDF_ProductEnq)VALUES ( @AccNo, @CompanyName, @Desc2, @RegisterNo, @Address1, @Address2, @Address3, @Address4, @PostCode, @AreaCode, @Phone1, @Phone2, @Fax1, @Fax2, @NatureOfBusiness, @WebURL, @EmailAddress, @DeliverAddr1, @DeliverAddr2, @DeliverAddr3, @DeliverAddr4, @DeliverPostcode, @Attention, @SalesAgent, @DebtorType, @DisplayTerm, @CreditLimit, @CurrencyCode, @UDF_Shipvia, @UDF_freigh, @UDF_SourceIn, @UDF_ProductEnq)"> it's show error at:-        Must declare the scalar variable "@AccNo".if i run the application without add (AccNo,....)VALUES(@AccNo) into above codes it's working good..AccNo is into drop down list control..
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend