locked
assign / change listname at run time or pass list name as a variable RRS feed

  • Question

  • I am using sharepoint designer 2997. I would like to pass a list name run time to my below code. What I have to change in the below code?Basically my reuquirement is if i select '1' item in combo box then 'listname1' should select and if I select '2' item in combo box then 'listname2'  should go as a variable to listname. Here is the code...I highlightened the listname where I want to pass the listname as a value. Thanks a lot in advance.

     

    <form id="form1" runat="server">
    <WebPartPages:DataFormWebPart runat="server" IsIncluded="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="0" Title="sp1" ListName="{4B0E99ED-9004-405D-8D2C-46128B6B3476}" Default="FALSE" DisplayName="sp1" __markuptype="vsattributemarkup" __WebPartId="{FB5BBA15-FF40-4240-9C9F-A9D8A6C487BD}" id="g_57e1a894_12e7_42d3_b0e5_875d7b924afe">
    <DataSources>
    <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="sp2"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="4B0E99ED-9004-405D-8D2C-46128B6B3476"/></SelectParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="4B0E99ED-9004-405D-8D2C-46128B6B3476"/></DeleteParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="4B0E99ED-9004-405D-8D2C-46128B6B3476"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="4B0E99ED-9004-405D-8D2C-46128B6B3476"/></InsertParameters></SharePoint:SPDataSource>
    </DataSources>
    <ParameterBindings>
    <ParameterBinding Name="ListID" Location="None" DefaultValue="4B0E99ED-9004-405D-8D2C-46128B6B3476"/>

     




    Monday, July 18, 2011 7:48 PM

Answers

All replies

  • Try to use Javascript.

    Can you also provide a bit more details on your exact requirement?

     

    Tuesday, July 19, 2011 1:33 AM
  • I have dropdown box having values "Sales" and "Purchaeses" When I select the "Sales" in that dropdown box, list1 should execute and when I select "Purchaeses" list2 should execute. I am using sharepoint Designer 2007. No C# code...If you look the above code, I have highlighted the places where list1 or list2 should go based on selection in dropdown box.

    Tuesday, July 19, 2011 4:48 PM
  • Create this form inside a empty dataview webpart & then create a property( you can use a user control or anthing which will pass the value to the parameter list ID based on the XSLT choose.

    try it out else I can protype it for you in the evening for sure I this this for hetting user profile & then do permission based on his profile.

     


    Happy Sharepointing... Regards SPTECH07
    Tuesday, July 19, 2011 4:53 PM
  • Hi Can you please help me in providing the code or the process. I am fresher to SharePoint.
    Wednesday, July 20, 2011 3:39 PM
  • I don't belive that there's a way to change the DataSource at run time. What I would suggest is building two separate DVWPs. Based on the value of a Query String parameter, you can determine in each DVWP whether you should show anything. For instance, a Query String parameter like ?ListName=Sales.

    Alternatively, use script and SPServices to call GetListItems to populate the combobox based on the selection.

    M.


    Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices) - USPJ Academy
    Wednesday, July 20, 2011 10:24 PM