.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

SharePoint - Defaulting a Value into the obscure SharePoint:FormField controlMode=New code line

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :SharePoint
I think I've done it before somehow. but can't remember. Is there any way to force a default value into this  Markup? I've tried a few things with no luck.  Iknow i can doing in javascript codek but wanted to double check I might just not be able to force it here. The code below is binding my a column textbox to a list column while in insert mode.  Generated when I ask the DataView Designer to create a NEW button.  I just want to force the value of a querystring parameter into the column and really not even see the column. Thanks     <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}" />

View Complete Post

More Related Resource Links

Is your code running in a SharePoint Sandbox?


You could execute a function call that is not allowed in the sandbox (for example call a static method on SPSecurity) and catch the exception. A better approach is to test the friendly name of you app domain:

AppDomain.CurrentDomain.FriendlyName returns "Sandboxed Code Execution Partially Trusted Asp.net AppDomain"

Because you can never be sure that this string changes in the future, a safer approach will be:


See http://www.sharepointoverflow.com/questions/2051/how-to-check-if-code-is-running-as-sandboxed-solution for a discussion on this topic.

Code to get how many users are logged in to the sharepoint site

How to get the users of my sharepoint who are online.....

Thanx in advance,


Resume SharePoint Services Web Application and returns code 1387 error


Hello everyone! Newbie here. I would like to ask how to start the SharePoint Services Web Application on (WSS3.0,internal database, stanalone users) without getting error 1387 ?

I would love to provide more information regarding this issue but what I got is error 1387 displayed in the browser.

I look forward to seeing you guys feedback from your expertise angle.



Administrator and Developer Guide to Code Access Security in SharePoint Server 2007

Explore configuration options, get best practices for managing CAS in SharePoint environments, and walk through a complex CAS scenario.

Video: SharePoint 2010: Executing Code in the Sandbox

Find out how the Sandboxed Solutions Service provides for a complete isolation system that ensures code running in a sandboxed solution cannot reach out to access information beyond the scope of the deployment. (Length: 12:01)

Custom SharePoint Timer Job doesn't run after changing code and restart timer services.

Hi We are facing an issue that our custom SharePonit Timer Job doesn't run after a changing the code. First, we developed and deployed a timer job. It worked fine for a few days, then we detected a memory leak and killed the OWSTIMER.EXE. (Maybe we should uninstall the timer job and restart the timer services nicely). We fixed the problem, redeployed the fix as a feature (assemblies are re-GACed ...) to our small SharePoint farm (one web server, one services server), restarted the SharePonit Timer Services. Now we can see the time job in Timer Job Definition in Central Admin but the job never runs (Since it doesn't run, the timer job status page doesn't have any info about it). We tried the same process in a dev environment with SharePoint signle box installation. The timer job just works fine. I did some search on Internet and followed some instruction to clear the cache from "C:\ProgramData\Microsoft\SharePoint\Config\1d50d73c-9bf1-4444-85a9-910ed050d1bf" by 1. Remove all the xml2. Clear the cache.ini with "1".3. restart the timer services. It still doesn't fix the problem.Please advise what else I can do. I even rename the timer job and redeploy it. It doesn't help. I checked the even log and SharePoing log and couldn't see anything wrong. Our OS is W2K8.         public override void FeatureActivated(SPFeatureReceiverProperties properties)        { 

Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

Firexfox and SharePoint Forum - a reply shows html code

When users use Firefox to view SharePoint and are replying to a post of the forum\discussion board the reply box and view box already has the HTML code in. For instance the body field contains:- <div><br/><br/><hr/> <b>From: </b>Kevin Shilling<br/> <b>Posted: </b>03 August 2010 15:17<br/> <b>Subject: </b>CHRISTMAS IS COMING...<br/><br/> <div>Yes, I know it is only August but thinking ahead what do you think about hosting our annual Open Evening for local neighbours, suppliers and friends and family. Do you think it is a good idea or not? Let me have your thoughts before the end of September when planning usually starts.</div></div> Anyone come across this and found a fix? Regards Mike

How do I get column values in Sharepoint designer so I can use them as a variable in code block?

The code below is in my EditForm.aspx and it works but instead of it outputting "This is just a test!" I need get a number that is stored in a column named Phone Number that has 5555555555 stored in it and have the line that says TD2.innerHTML = "This is just a test!"; ouput what ever number is stored in the Phone Number column. Here is the code that is in my EditForm.aspx <script type="text/javascript">function DisplayItemID(){       var TD1 = document.createElement("TD");       TD1.className = "ms-formlabel";       TD1.innerHTML = "<h3 class='ms-standardheader'>Test</h3>";       var TD2 = document.createElement("TD");       TD2.className = "ms-formbody";       TD2.innerHTML = "This is just a test!";       var IdRow = document.createElement("TR");       IdRow.appendChild(TD1);       IdRow.appendChild(TD2);       var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0]; 

Does anyone know how to create a page that has Code behind in Sharepoint.

I am creating a page that will need some controls for dropdowns and radio buttons etc and I need to know if and how to setup and create a page in Sharepoint that has the code behind to handle click events, onselectedchange like .NET does.

How do I stop line feeds in a Hierarchy field from a SharePoint list to prevent wrapping

I'm developing a Reporting Services 2005 report that includes a Hierarchy field from a SharePoint 2007 list.  The Data Source for the report is an XML type. I would like to display the Hierarchy field on 1 line.  However, it is displaying in 2 or more lines. The field also wraps when rendering to Acrobat (PDF) file.  How can I get rid of the embedded line feed (I believe it's "&#xA").  I've tried using the Replace function in an expression, other functions and changed the properties, e.g., the CanGrow property.  Nothing seems to work. Does anybody have any suggestions?  Thanks.

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

How do I stop line feeds in a Hierarchy field from a SharePoint list to prevent wrapping in a SSRS r

I'm developing a Reporting Services 2005 report that includes a Hierarchy field from a SharePoint 2007 list.  The Data Source for the report is an XML type. I would like to display the Hierarchy field on 1 line.  However, it is displaying in 2 or more lines in Visual Studio 2005. The field also wraps when rendering to Acrobat (PDF) file.  How can I get rid of the embedded line feed (I believe it's "&#xA").  I've tried using the Replace function in an expression, other functions and changed the properties, e.g., the CanGrow property.  Nothing seems to work.   Here's what I get: LAW>Administrative Law LAW>Criminal Law LAW>International Law   I'd like to see something like this (I'm able to add the "/"): LAW>Administrative Law /LAW>Criminal Law /LAW>International Law/

Updating list item values in SharePoint Designer using code

Is it possible to programmatically modify the SharePoint objects using SharePoint Designer Object Model. By that I mean coding in SharePoint Designer (not Visual Studio). For example, can we access the list items of a list programmatically and change their values? I can do all this in Visual Studio using SharePoint Object Model but I don’t find a way of achieving this by using programming in SharePoint Designer. I searched through http://msdn.microsoft.com/en-us/library/bb208639(office.12).aspx but no success. If the answer is yes. Can someone please give example(s) or point to some articles etc? Thanks in advance.

SharePoint Dataview Insert New Mode - Defaulting a Required Column to a Query String Parameter Valu

I've got a SharePoint DataView with an insert button. there is a required lookup column I want to default to the value of Querystring Value during new mode.  Can I do this in the generated code below? I tried replacing @ApplicantId with @QSApplicantID.. and  tried string(@QSApplicantID) too.. no luck gave me an error: The data source control failed to execute the insert command. Could it be that QSApplicantID (which I've used in my DataView Datasource filter with no problem) is not available during the insert? I think I can do what I want in Javascript but was hoping I could instead right in the XSL markup. *my query string parameter**     ParameterBinding Name="QSApplicantID" Location="QueryString(ID)" DefaultValue="2222222"/ **the new form** SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="New" FieldName="ApplicantId" __designer:bind="{ddwrt:DataBind('i',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ApplicantId')}" / **the link** a href="javascript: {ddwrt:GenFireServerEvent('__cancel;dvt_1_form_insertmode={1}')}">Insert</a Thanks for any help or information!

Put value by default in a SharePoint:FormField

Hi all I would like to put a value by default in one text field. That value musct catch from a value called @ID (it comes from  the query string). I wanted to put in the Value attribute from the SharePoint:FormField tag, but it says: it can assign @ID to Value since Value is a object.Is the value property the correct one to put my value by default? If so, how can get this one?                    <td class="ms-vb">                         <SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="Edit" FieldName="Task_x0020_Id"  __designer:bind="{ddwrt:DataBind('u',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Task_x0020_Id')}" />                         <SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="Task_x0020_Id" ControlMode="Edit" /></td>  Kind Regards!

Add Calendar through code to page SharePoint 2010 - help

I am add a calendar to a page through a feature.  How do I set the view to be 'All Events'.  Currently the page gets rendered with the calendar in full graphic mode (showing all days in the month). I would like to through code have the calendar be visible by default 'All Events' ..help? I am using code similar to the following.  You can see some of the things i have tried (commented out lines)  ListViewWebPart calendarWP = new ListViewWebPart();                                     SPList calendarList = site.Lists["Calendar"];                                     //SPView view = calendarList.Views["All Events"];                                     calendarWP.ListName = calendarList.ID.ToString("B").ToUpper();                                     calendarWP.TitleUrl = calendarList.DefaultViewUrl;                                     calendarWP.WebId = calendarLis
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