.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

Pre-select item from newform.aspx

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint

Hey forumers,

Got a quick question to ask y'all.

Lets say I have a item in a list called software. And lets say the items name is SharePoint.
When I open the Item I'll go to the basic Edit view, On the edit view I have added a button called "Add Media".
When I click on that button I'll go to the NewItem.aspx in my Media list.

Now my question is:
If i hit the "Add Media" button from any item (in the software list) I want that software item selected in the lookup field.

I have been looking at Workflows or Javascript to do this but I can't get it figured out.
Any ideas are really appreciated.

View Complete Post

More Related Resource Links

How do I customize the item forms (NewForm.aspx, etc) in VS2010?

I have a SharePoint 2010 solution in Visual Studio 2010.  I have custom list definitions, instances, etc.  I want to customize the New, Edit, and Display forms for my custom list.  I not only want to customize the look, but I want to write my own code behind as well.  I have searched all over and have yet to find a good guide on how to do this.  Can someone please help?

Getting user control in NewForm.aspx of the list


I have designed a user control where i have placed some custom fields as per my requirement now my next step is as soon as user clicks 'Create' under Site Settings it should take him to my user control page instead of Newform.aspx default page of the list.Just let me know your suggestions to achieve this as it would help me a lot

Thanks & Regards,


how to hide/display controls in NewForm.aspx based on dropdown value in SharePoint list



I have 1 dropdown in my sharepoint list with other columns. If dropdown value equal to 'xyz' i need to display some other controls, otherwise these controls should be hidden.

I know we can achieve this with javascript. If any one can provide code or sample then it will be appreciated. or is there any other alternative methods to do this ........

Thanks & Regards, Neerubee

On New Item form, select item on choice dropdown based on query result.


I posted this on Experts Exchange awhile back with no answer, so here's hoping someone here has an idea :)

So I've mostly figured this problem out, but I need some help in getting over the hump... note that I'm using JavaScript to do this (SPServices) on SharePoint 07'.

I'm on the New Items page of a list. Based on a user's selection in a "Teacher" dropdown, I'm doing the following:

1.) Get the value of the Teacher field and several other fields (School and Visit Date)
2.) Run a CAML query based on those fields to find the last list item entered for that Teacher

So here's where I'm stuck...

I have 10 choice fields, all with choices 0, 4, 7, and 10. Depending on what they were set to in the last entered item (which I queried), I want to set the selected item on each of those dropdowns to equal that. So "Score 1" was set to "4" on the la

NewForm.aspx - Show/Hide fields dynamically

I have about 20 + fields in a custom list.  I want to be able to show and hide fields depending on user selection.  Does anyone know a way of accomplishing this? Ive tried some embedded javascript but can't seem to get it working in sharepoint. Please help :)http://lbellows.blogspot.com http://www.ptreviews.net

Can't select combobox item with mouse

I have a bizarre issue with my wpf 3.5 app that I just wrote. One of the computers we installed it on won't allow the user to select an item from the combobox with the mouse. The mouse can make the drop down appear like normal, but when the mouse hovers over the items they are not highlighted and clicking on one closes the drop down but doesn't select the item. This is the default combobox with no style and only the margin, itemssource and selecteditem properties set. I tried other programs that have comboboxes (IE7, Excel, a VB6 app) and all of them work just fine. We have this program installed on numerous computers throughout our company and everyone else's is working correctly. I tried uninstalling the program and the .NET framework then reinstalling. I don't know what else to try.

CascadingDropdown Extender select item on pageload

I have a form that two cascadingdropdown extenders, when the page loads  the form is populated and cascadingdropdowns do work however the values should be set as the page loads.  I have tried setting the selectedvalue of the CDD but that doesn't take.   How do I set the values of the CDD with data from a db?

Problem Add Category Item by select department

Add Category Item by select department Firstly database has two tables Department and Category Department Table Id -------int  (PK) dep_name--------nvarchar(50) dep_description---------nvarchar(100) -------------------------------------------------------- Category Table Id------int cat_name------- nvarchar(50) cat_description----------- nvarchar(100) IsActive--------bit DepartmentId-----int   (FK) ---------------------------------------------------------- I have form contain DetailsView control under name CategoryDetailsView. My problem: this mechanism not duo correctly I don't know why,  only show to me when I run page" Procedure or function InsertCategory has too many arguments specified. " My idea when a user need to create category must on him write category details ( category name, Description, IsActive) and select this category where to insert by select department name from drop downlist This control connecting with table under name Category, insert process by stored procedure under name sp_InsertCategoryALTER Procedure [dbo].[InsertCategory] (@cat_name nvarchar(50) ,@cat_description nvarchar(100),@IsActive bit , @Result int output)AsBegin Insert Into Category (cat_name , cat_description, IsActive ) Values (@cat_name , @cat_description, @IsActive ) Select @Result = @@IdentityEnd <asp:DetailsView ID="CategoryDetailsView

SharePoint 2007, Modify Tooltip Text in SharePoint forms: EditForm.aspx and NewForm.aspx

I have a list in SharePoint that was created awhile back.  The names assigned to some of the columns in the list are no longer relevant.  Due to existing code, the column names cannot be modified to reflect the preferred names.  I was able to change the lables assiciated with these fields within forms NewForm.aspx and EditForm.aspx.  All looks and works just fine except for when the curser lingers in one of these fields, the tooltip that appears contains the underlining (original...no longer relevant) column names.  This is confusing to the user since the name within the lable and the tooltip are different.  I would like a way to either disable the tooltip from displaying or to modify it to display a custom value.  Below is the code from behind the form as it appears in Sharepoint Designer.  I would appreciate some input on this. <SharePoint:FormField runat="server" id="ff11{$Pos}" ControlMode="Edit" FieldName="My_x0020_Field_x0020_Name" __designer:bind="{ddwrt:DataBind('u',concat('ff11',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@My_x0020_Field_x0020_Name')}"/> <SharePoint:FieldDescription runat="server" id="ff11description{$Pos}" FieldName="My_x0020_Field_x0020_Name" ControlMode="Edit"/>


Hello, in my lists, i'm trying to figure out how to open the Newform.aspx in a new window. I've read all other  solutions but they don't seem to be very clear. What i want is when a user clicks on a the new button (Add a new item to this list) the form should open in a new window, and then once its been completed, and the user clicks ok, it should refresh the page and redirect to the AllTtems.aspx with the new list item that was created displayed. Please if anyone has a code to perform this. Help. Thanks for your assistance -Ug

change focus on controls in sharepoint list newform.aspx

hi all. i have newform.aspx where i hav required fields . when i say ok to enter the values the required field valiedates and shows error messages. but the problem is that the focus where it is suppose to get placed is promting in differnet place. can i change the focus of the controls inside newform.aspx or editform.aspx?jayaraja

Need help when selecting an item from one dropdown list it populates the 2nd dropdown on aspx page

Does anyone know how to do this so when I select something the 1st dropdown and the 2nd one becomes visible and populates list from a Select statement. I really need help on how to do in an aspx and not on the code behind page.

How to customize the wording of "Add new Item" in AllItems.aspx ?

Team, Can we customize the wordings of "Add New Item" to something else like "Add new account"  in AllItems.aspx ? If yes how do we do it. Is it through designer? Thanks in advance. Bhadram.  

How to add a new button to the newform.aspx page which says "Save and add another record" ?

Team, I have a scenario where my client wants me to add a nother button to NewForm.aspx page in addition to Save and Cancel buttons. The job of that buttom should be to save the record and open that new form again. Is this possible.If yes can you guie me how to do it though designer? Thanks in advance. Deepti.  

How to preset lookup value in newform.aspx?

Trying to preset value of "contract" value in "payments" newform.aspx: var tmp = new Array();   var tmp2 = new Array();   var get = location.search; if(get != '') {  tmp = (get.substr(1)).split('&');  for(var i=0; i < tmp.length; i++) {   tmp2 = tmp[i].split('=');    if (tmp2[0]="contract")   {    document.getElementById("ctl00_m_g_74acdc2d_d0d7_40f0_92fe_591f907f295a_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_ctl01").value=tmp2[1];    break;   }  } } User see that correct value (translated through url) is choosed. But after user saves new item, it's appers with empty value of "contract" field.

select n-th item

I would like to select the n-th item from a list. One way I know how to do it is like this. Please follow this example. Create a table and insert a bunch of integers in random order. create table A (col int) insert into A values (294) insert into A values (150) insert into A values (200) insert into A values (12) insert into A values (1000) insert into A values (56) insert into A values (750) insert into A values (62) insert into A values (560) If I want to select the N-th largerst number from table A, I can do this. (replace <N> with whatever number you want) select max(x.col) from ( (select top <N> col from A order by col) ) x So, if N = 5, then you should get 200 from the above example.   I'm looking for another way to do this using the rank() function. I know you can use rank() like this. select rank() over (order by col) num_rank, col from A But, how can I use num_rank column to get the N-th item. I tried something like this, but doesn't work. select rank() over (order by col) num_rank, col from A where rank() over (order by col) = 5  

how to do a ajax integrated validation in required field sharepoint newform.aspx

hi all, i have newform.aspx in sharpeoint list where in i have 2 cols which are reqd field. how would i make the server side validation without refreshing the page.. can i put it ajax update panel ?  how would i achieve this requirement.jayaraja
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