tag:blogger.com,1999:blog-5760703966775804012.post404585021815547483..comments2023-09-21T01:41:34.469-07:00Comments on Share The Learning: Using Parameters in the SelectCommand of a Data View Web Partwhats.to.learn.todayhttp://www.blogger.com/profile/06525868686626493995noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-5760703966775804012.post-38296807735390237772011-04-01T05:47:08.609-07:002011-04-01T05:47:08.609-07:00Thanks for the quick response and sorry for failin...Thanks for the quick response and sorry for failing to check that my post rendered properly.<br /><br />I have a page that I've inherited which contains this DataFormWebPart and works for 90% of the content to be rendered. However, the new content needs to be rendered without the first sort field (there are 4 subsequent sort fields). <br /><br />So this is my problem area. How do I alter the selectcommand (the Order By bit) based on the URL (which already contains a parameter which I can use to identify between the two types of content)?<br /><br />Is it possible to evaluate the content of the querystring, before the substitution into the selectcommand takes place, like:<br /><ParameterBinding Name="mySortOrder" Location="EVALUATEIF(QueryString(ID)=='3','<Order By><FieldRef Name="F2" Ascending="TRUE"/><FieldRef Name="F3" Ascending="TRUE"/></Order By>"/>','')" DefaultValue="<Order By><FieldRef Name="F1" Ascending="TRUE"/><FieldRef Name="F2" Ascending="TRUE"/><FieldRef Name="F3" Ascending="TRUE"/></Order By>"/><br /><br />And is it actually possible to substitute this much (i.e. from the start to the end Order By tags) into the select command?<br /><br />Once again, thanks.Unknownhttps://www.blogger.com/profile/16533978925147731784noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-22161018876539081552011-03-31T20:11:42.217-07:002011-03-31T20:11:42.217-07:00Hi Jack,
Do you need you need to use a data view,...Hi Jack,<br /><br />Do you need you need to use a data view, or is there any chance that a list view might do? Reason I ask is that the standard list view gives you the option to filter by fields in the querystring. Here's an example of the querystring derived by selecting to filter "TrustStatus" by the value "Active" and "Office" by "Auckland":<br /><br />http://mysite/lists/somelist/allitems,aspx<b>?View={E95C2A4B-D457-4E3B-ACAC-A3D46633D5E6}&FilterField1=TrustStatus&FilterValue1=Active&FilterField2=Office&FilterValue2=Auckland</b><br /><br />Maybe you could build this type of URL to achieve your aim?whats.to.learn.todayhttps://www.blogger.com/profile/06525868686626493995noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-91839757970219876982011-03-31T18:56:14.289-07:002011-03-31T18:56:14.289-07:00Really interesting post. I realise this is a relat...Really interesting post. I realise this is a relatively old post but...<br /><br />I have a web part that I'd like to dynamically change the part of my selectcommand based on the querystring of the page's URL. <br />If my querystring variable, say 'X', equals 1, I want the sort order to be ColumnX, ColumnY. If X equals some other value, I want the sort order to be just ColumnY.<br /><br />1. Is it possible to parameterise the entire , so can be parameterised as, say, {myOrderBy} ?<br />2. Is it possible to conditionally test the querystring and to determine what to store in the parameter<br /><br />..or perhaps there's an alternative way to solve my problem.Unknownhttps://www.blogger.com/profile/16533978925147731784noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-47110521230227361922009-07-22T13:17:50.396-07:002009-07-22T13:17:50.396-07:00What about using parameters to filter. I can't...What about using parameters to filter. I can't seem to "unfilter" a dataview using a form control without a page refresh.Leonhttps://www.blogger.com/profile/05406062462002559450noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-45959222716821363012008-07-01T20:13:00.000-07:002008-07-01T20:13:00.000-07:00Hi Alessandro,I think you may have the values in y...Hi Alessandro,<BR/><BR/>I think you may have the values in your custom DataFormParameter wrong. <BR/><BR/>Every custom WebPartPages:DataFormParameter that you add requires the PropertyName attribute set to "ParameterValues". This is then used when parsing the values. <BR/><BR/>Set the ParameterKey and Name attributes to the name of your new parameter - the name of "SelectedRisk" in my example demonstrates the values you need to change in the SPDataSource, the DataFormParameter and the ParameterBinding elements.<BR/><BR/>Hope that helpswhats.to.learn.todayhttps://www.blogger.com/profile/06525868686626493995noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-71258707668720935112008-06-26T01:01:00.000-07:002008-06-26T01:01:00.000-07:00hi, I've the same error: DataBinding: 'Microsoft.S...hi, I've the same error: DataBinding: 'Microsoft.SharePoint.WebPartPages.WebPartPage' does not contain a property with the name 'ParameterValues'.<BR/>could you help me?<BR/>thank you in advance<BR/><BR/>alessandroUnknownhttps://www.blogger.com/profile/04053956681384580089noreply@blogger.comtag:blogger.com,1999:blog-5760703966775804012.post-58181716867134418942007-11-06T05:39:00.000-08:002007-11-06T05:39:00.000-08:00Help pls:For:[SelectParameters][WebPartPages:DataF...Help pls:<BR/>For:<BR/>[SelectParameters]<BR/>[WebPartPages:DataFormParameter PropertyName="UserId1" ParameterKey="UserId1" Name="UserId1" /]<BR/> [/SelectParameters]<BR/>[...]<BR/>[ParameterBindings]<BR/> [ParameterBinding Name="UserId1" Location="ServerVariable(LOGON_USER)" DefaultValue="0"/]<BR/> [/ParameterBindings]<BR/><BR/>I got next:<BR/>Error while executing web part: System.Web.HttpException: DataBinding: 'Microsoft.SharePoint.WebPartPages.DataFormWebPart' does not contain a property with the name 'UserId1'Roman Kvasnyjhttps://www.blogger.com/profile/01563232119541941692noreply@blogger.com