Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Thu May 23, 2013 9:37 am

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Updating Parameters automatically when a record is set in SP
PostPosted: Fri Apr 22, 2011 4:43 pm 
Offline

Joined: Mon Feb 01, 2010 12:47 pm
Posts: 12
I am having problems with getting the parameters on a aspx page to update and need this to happen automaticly when the user querys for a record. I am querying a sql database external to the sharepoint site and creating a list record in a SPlist from this form. I can get it to work but not without having to manually clicking a postback script from the listview. The user is not going to want to have to click the record, binging that its the only record in it, it is a pointless extra step.

I followed this artical, http://www.sharepointhillbilly.com/arch ... ow-up.aspx to create the parent/child relationship and pass the string to the SPlist. In SP2007 it works great, but in 2010 I can not get parameters to update with the fields values to pass to the new form without making the user click a link with a DoPostback call. I need it to do this post automatically once the parent listview is populated with the record.

Can anyone help with with getting this to happen when the listview is populated with the data from the SQL string? .


Top
 Profile  
 
 Post subject: Re: Updating Parameters automatically when a record is set i
PostPosted: Fri Apr 22, 2011 7:51 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 6:02 pm
Posts: 1035
Location: Silver Spring, MD
I've done this technique in SP2010, MOSS, WSS... It just works. Make sure you are setting the variable correctly within your DVWP. It should be similar to:
Code:
text={$QueryStringParam}

If that's not the issue, post your query string's name and the code from SPD. I'll see what I can do ^_^.


Top
 Profile  
 
 Post subject: Re: Updating Parameters automatically when a record is set i
PostPosted: Mon Apr 25, 2011 1:46 pm 
Offline

Joined: Mon Feb 01, 2010 12:47 pm
Posts: 12
Thanks Matt for the help. I do not think it is any of the variables, it works but I have to click the Hyperlink created in the list view data connection set up in Step 3 of the page I ref. in the question. The parent custom list view has a data source connecting to a Sql server, with a query that is basic, Select * from tblItemsHistoryLookup with it's filter set to fldItemID = ‘txtItemUID’ (a control textbox on the page). The user enter a UID and using a command button with submit behavior set to true, I filter the recordset which then populates the listview simply by refreshing the parent DVWP. It is at this point, at least in SP2007, the Parameters are set or reset to equal the fields from the recordset.
The code to pass the data to the New form for the inventory list is below:

<td class="ms-bottompagingline2">
<img src="/_layouts/images/blank.gif" width="1" height="1" alt=""/><a href="frmNewItems.aspx?Item ID={$pItemID}&amp;Item Description={$pItemDesc}&amp;Mfr Item Name={$pMfrItemName}&amp;Mfr Part Number={$pMfrPartNumber}&amp;Manufacturer Name={$pMfrName}&amp;Service Life={$pSrvLife}&amp;AcqDate={$pAcqDate}&amp;Service LifeIncrement={$pSrvLifeInc}&amp;Category={$pCatID}&amp;CategoryType={$pCatTypeID}&amp;Type Classification={$pTypeClass}" onclick="javascript:this.href = unescapeProperly(escape(this.href)); GoToLink(this); return false;" target="_self"><span class="style1">Click here to add this item</span></a>
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</td>

I have looked at this and the parameter bindings countless times and can’t see anything wrong with it although some of the parameters are listed twice with different locations. I deleted the ones set to none but no change in the output.

It works when I click the SP generated script to do a post back, which sees the data values from the SQL query string.

javascript:__doPostBack('ctl00$m$g_ef50842f_2728_43a4_bef2_4c52f8a15594','__connect={g_4cbd11bc_88da_4271_8290_6cd10e8f64cc#g_ca9345ee_26ee_4983_9815_42168f20e922*@fldManufacturerName=DELL#@fldServiceLife=60#@fldMfrItemName=GX 755#@fldCategory=11#@fldAcqDate=2008-02-20T07:00:00Z#@fldServiceLifeIncrement=Months#@fldItemDescription=DESKTOP#@fldItemID=S901248#@fldMfrPartNumber=GX 755#@fldCategoryType=54#@fldTypeClassification=1};')

This is where the problem is, without clicking the hyperlink created by SP in the DVWP, the link on the page is missing the data values from the parent:

https://sharepoint.../sites/DV6PMRS/dpm ... .aspx?Item ID=&Item Description=&Mfr Item Name=&Mfr Part Number=&Manufacturer Name=&Service Life=&AcqDate=&Service Life Increment=&Category=&Category Type=&Type Classification=

Once I click the hyperlink, it displays the data in the query string and the new form opens and populates with these values in the txt boxes.
https://sharepoint.../sites/DV6PMRS/dpm ... .aspx?Item ID=S901248&Item Description=DESKTOP&Mfr Item Name=GX 755&Mfr Part Number=GX 755&Manufacturer Name=DELL&Service Life=60&AcqDate=2008-02-20T07:00:00Z&Service Life Increment=Months&Category=11&Category Type=54&Type Classification=1

I am at a loss with this, I have compared the page I created in 2007 with this one in 2010 and everything seems to be there, but it will not post the data without clicking the hyperlink. It’s as if I have something turned off that makes this happen automatically.

Again thank you for any assistance,
Mike


Top
 Profile  
 
 Post subject: Re: Updating Parameters automatically when a record is set i
PostPosted: Mon Apr 25, 2011 6:24 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 6:02 pm
Posts: 1035
Location: Silver Spring, MD
Alright, you win... You've lost me when you started talking about web part connections... There aren't any web part connections built in Mark's videos. He's using a query string parameter and passing that to a new form. That ties the child to the parent.

However, I have built a few DVWP's that expose data from SQL server and have used the web part connections a lot in the past. Sounds like you should remove the connection that you have already built and instead of choosing "Filter", choose, "Pass a Parameter". I've ran into this in the past and because of this behavior, I never use Filter any more.

Let me know if that helps.


Top
 Profile  
 
 Post subject: Re: Updating Parameters automatically when a record is set i
PostPosted: Wed Apr 27, 2011 6:08 pm 
Offline

Joined: Mon Feb 01, 2010 12:47 pm
Posts: 12
I hate stumping the panel...
I referenced webpart connections because "Web part Connection Wizard" is the title on the wizard he uses in the article, not one of his videos though its on his blog wherein step 3 he pass the data from the parent data view web part (DVWP?, just checking we are talking the same thing, I have use the acronyms incorrectly before) to the child DVWP. http://www.sharepointhillbilly.com/arch ... ow-up.aspx

I see what your saying though the filtering is only done in the datasource not applied to the dataview connection but I'll try recreate the datasource with a sql statement and connection making sure I am using "Get Parameter from" option.

Thanks
I'll post once I figure out what I am doing wrong.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group