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

Post New Web Links

How to get request.form working in masterpages?

Posted By:      Posted Date: November 04, 2010    Points: 0   Category :ASP.Net
Hi all,

On pages that use masterpages, request.form always return null. It works fine on pages without masterpage. Is this normal? How to use request.form in pages with masterpages?

Thanks in advance.

View Complete Post

More Related Resource Links

Automatically populating Contact Selector not working in Form Services

Hi,I'm currently working on a form where i wan't to automatically populate a contact selector control with a users manager. I've got the managers userid, called the ResolvePrincipal webservice provided by sharpoint, and set all the values in the contact selector with the correct values. When previewing it works perfectly however when i move the form to Form Services it won't work.I've tried setting it via rules: i.e. on the change of a textbox write the manager values to the contact selector.I've tried setting the default values of the contact selector to fields where i write the manager values.I've tried setting it through code i.e. SelectSingleNode() and SetValue() for each of the fields in the contact selector.All of which work fine in preview mode but will not work in Form Services, UNLESS the contact selector already has a user in it. So if the contact selector is blank it won't work, however as soon as i manually select a user then try using any of the previously mentioned methods of setting the control it works. While using code i get a nullreferenceexception which leads me to think that possibly when theres no user in the control the xml nodes representing the AccountId, DisplayName, AccountType don't exit???? TO throw another spanner in the works, on the very odd occasion it will work in Form Services as expected, after celebrating and trying again it returns

Difficult in using Request.Form

Hi all,i just try to pass value between pages using Request.Form,Here the scenario,1.First i created a two aspx pages(First.aspx and Second.aspx), First.aspx is a main page and Second.aspx is a popup.2.in the main page i created a button with type submit and text box , and in the button  onclick i call a function in the javascript which open the popup page3.When i try to retrieve the values from the main page in the popup i can't retrieve the valuesHere the codeFirst.aspx=========================================================<script language="javascript"> function fnClear() {window.open("Second.aspx","sendvalue","height=350,width=700,scrollbars=1");                }</Script><form id="mainpage" name="mainpage" method=post runat="server"><input type="text" name="txtStDate" runat="server" tabindex="1"                                                                                                 id="txtStDate" maxlength="

AJAX Form POST Request to a DLL Problem

I am using AJAX javascript for POSTING a complete HTML form to the server which is an external dll on a different server and displaying the response. The server-response is displayed in a "div" . basically i need to show a poll in a .aspx page which is basic a question with 3 options & a button. Now on click of submit button i need to post the data to a dll & show the result from the dll itself. Any idea how to do this? is it possible..any code???

Binding list to form not working with '&' character in list field data

Hi, I have a SharePoint list with a field called Title. I have a form based on this list with the field bound to the form as a label (for workflow to access). Here is the code for the form field. <asp:Label runat="server" id="ff2{$Pos}" text="{@Title}" __designer:bind="{ddwrt:DataBind('u',concat('ff2',$Pos),'Text','','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}" /> I have a workflow that runs through a form action button which take ff2 (title) and  does other stuff. The problem I have is with records where the value of 'title' contains the '&' character (example ab&cd). Blank is pulled in by the workflow when I get the value of ff2. I am guessing it has to do with the data binding and/or escape (special) characters coming through but I don't know how to fix it. Any help will be greatly appreciated

Validation is not working in Custom List Form using JavaScript ddwrt:GenFireServerEvent()

Hii am creating custom New form for a list using sharepoint designer. i have added the below button for sumbit<input name="Submit1" type="submit" value="Submit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={http://myserver/Lists/VTest/AllItems.aspx}')}" />                <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;                                    </xsl:text><input name="Submit2" type="submit" value="Cancel" onclick="javascript: {ddwrt:GenFireServerEvent('__redirect={http://myserver/Lists/VTest/AllItems.aspx}')}" />the problem is the validation is not working properly. it submits the page without entering values for the required fields.particularly the validation is not working for DateFields.let me know what is the problem here. is it a Bug?muthu

Clearing ValidationSummary when form returns a download request



Here's my setup:

Simple mvc page with a few controls that includes a validation summary area. 

Once the fields are completed there's a download button.

If I enter something invalid, as expected, my controller code updates the UI with the appropriate error.  However, if I then correct the error, and then click the download button a file is downloaded, but the UI never gets updated - presumeably since there's no update on the view.

Any ideas on a way around this - perhaps some javascript code.  Just wondering what's the best practice here?


Leave Request Form


I now have recreated my Leave request form in sharepoint designer and just need a few pointers.

Ill explain what i have first.

I have a document libary call time-off request here users can fill out a word template requesting leave they fill out the following fields.

Employee Name, Start Date: Return Date: Type Of Holiday

Once they have saved this back to the libary the workflow starts it marks the status of the request to open it then copys the item into a new list called Time-Off Request Status and then deletes the item in the Time Off Request List finally it emails the manager of that employee telling them to approve or reject the request in the the Time Off Request status libary.

There is another workflow attached to the Time Off Request status libary where if the manager approves the request it sends an email to that user and updates days remaing in a final list called annual leave remaining.

The problem that i have is any user can go into the Annual Leave remaining list and change the number of days that they have left however i need them to have the contribute permission so the workflow can update the list.

I asked a similar question back when i created this in Sharepoint Services  3.0 and was told something about impersonating work flow steps but i am unsure of how to do this.

Also the workflow does no

wcf 4 rest service accepts xml and json posts but get 400 bad request on form post


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content.  All data gets correctly mapped to the corresponding properties in my entity. 

I want to also support a standard form post to the method but am having problems! 

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I figured it would "just work" but no.

I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

Really straightforward but fails.  Ideas why? 


      var client = new HttpClient();

      HttpUrlEncodedForm form = new HttpUrlEncodedForm();
      form.Add("Id", "99"<

use infopath form for request and appoval



i have created an infopath form. when the user submit this request form to the specific approver a mail will be sent to the specific approver.

now i want that when the approver open this form, the fields that the user had filled must be read only and the approver section must not be read only. the appover must be able to approve the form and submit the same form to the hr.

the approver section has a dataview list where the approver can choose if the request is approved or rejected.

i know i can use a workflow, but if i use a workflow can the workflow send the request to the specific approver of each user?

cause in my form when the user open the form there is a field that is filled with the specific approver of the user. and when the user click on the submit button the form will be send by mail to the specific approver.



A potentially dangerous Request.Form value was detected from the client


I know this has been discussed already but my problem isn't the error itself. My problem is I am including [ValidateInput(false)] above my ActionResult and I still receive this error when I click submit. Is there something somewhere else overriding this command?

Here is what the code looks like.

[Authorize(Roles = "Administrator")]
        public ActionResult Create(FormCollection Form)

[Authorize(Roles = "Administrator")]



IE 9 Beta & InfoPath 2007 Form Radio Buttons Not Working



Has anyone else come across the IE9 bug that causes the radio buttons in the InfoPath 2007 forms to stop working (i.e. unselectable)?

Did you find a workaround (other than not to use IE9!)?



Customized form not working with attachment

I created a customized edit form using the "Custom List Form" in SharePoint Designer.  Now the attach file button no longer works.  I am getting "This form was customized not working with attachment."  Has anyone found a workaround for this?

Zoom while working in form designer?


While working in the form designer of visual studio, is it possible to zoom into parts of the form for working in crowded areas? I can see how to zoom in and out of the code text with the ctrl key & middle mouse wheel, but I don't see a way to do that in the designer mode. Is there an addon perhaps that will allow this?


Help! Can't find dynamic button's postback in page.request.form??


Okay, I know that dynamic buttons and buttons in general don't use a typical postback and they post through the page.request.form.  Okay, so in visual studio, I was able to determine that page.Request.form and in the all-keys property, i SEE my button there.  It is the last item in all-keys.

When I am clicking this dynamic button which is in an updatepanel, the script below does not detect it as a button, it is still showing it as null:

public static Control GetPostBackControl(Page page)

            Control control = null;
            string ctrlname = page.Request.Params.Get("__EVENTTARGET");
            if (ctrlname != null && ctrlname != string.Empty)
                control = page.FindControl(ctrlname);

Get CssClass value using Request.Form


Hi all,

Is it possible to get the CssClass and SkinID via Request.Form? 

I tried below but failed.

Dim i As Integer
        Dim itemName As String
        Dim itemValue As String

        For i = 0 To HttpContext.Current.Request.Form.Count - 1
            itemName = HttpContext.Current.Request.Form.AllKeys(i)
            'itemValue = HttpContext.Current.Request.Form.GetValues(i)(0)
            itemValue = HttpContext.Current.Request.Form.Get("CssClass")


A potentially dangerous Request.Form value was detected from the client



i have a form that use can insert some text in textbox

if user insert <..> page return an error like

A potentially dangerous Request.Form value was detected from the client 

the problem is i need to user inter some html code that's because i change the code in web.config file

<pages validateRequest="false"

URGENT!!, A potentially dangerous Request.Form value was detected from the client



I get mails about an unhandled error has occurred:
Message: A Potentially Dangerous Request.Form value was detected from the client (ctl00 $ default master content $ txtCustomerMessage ="... ???????? <a href = "http://aovo ...").

 Stack Trace:
   at System.Web.HttpRequest.ValidateString (String s, String Value name, String collection name)
   at System.Web.HttpRequest.ValidateNameValueCollection (name value collection nvc, String collection name)
   at System.Web.HttpRequest.get_Form ()
   at System.Web.HttpRequest.get_HasForm ()
   at System.Web.UI.Page.GetCollectionBasedOnMethod (Boolean dontReturnNull)
   at System.Web.UI.Page.DeterminePostBackMode ()
   at System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.AsyncPageProcessRequestBeforeAsyncPointCancellableCallback (Object state)
   at System.Web.HttpContext.InvokeCancellableCallback (wait callback callback, Object state)
   at System.Web.UI.Page.AsyncPageBeginProcessRequest (HttpC

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