.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

DVWP filtered by 2 querystring parameters

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


I hope someone is able to help me solve this problem I've been having.

What I'm trying to do is this:

I currently have 2 DVWP on my page, formatted as dropdowns.   I want to have these dropdowns filter my main DVWP.   I'm doing this by the way of a querystring,  and I can get it working but with only 1 filter at a time.

I also want my main DVWP to display all records by default,  which I've also been able to do.  with something like this,  this works for only the first dropdown. 

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@Content_x0020_Owner.title = $contentowner or $contentowner = 'All Content Owners']"/>

So I thought I could do something like this, to make it look at both dropdowns

[@Content_x0020_Owner.title = $contentowner or $contentowner = 'All Content Owners' and @Category = $categoryselect or $categoryselect = 'All Categories']"/>

but this ignores the category dropdown.  As a test,  I removed the $contentowner part, and the category filter began working.   So it has to be how I have this written.

Eventually how I want it to work,  is so that both filters can be used together.   Meaning if the user makes a selection in the first dropdown, 

View Complete Post

More Related Resource Links

Trying to get basic Http URL with querystring parameters processed in WCF service

I'm trying to process a post by a third party server (Paypal) processed by my server through a WCF service. All I need is to get and process the values with the query string. This sounds incredibly easy, but after a weekend, I'm still stumped.  Any help would be greatly appreciated. Passing the following URL from my browser to the service causes a AddressFilter mismatch fault (below). http://localhost:9409/PPInfo.svc/ReadResponse?RESULT=0&AUTHCODE=10001&RESPMSG=APROVED&PNREF=12345 produces <Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"> - <Code>   <Value>Sender</Value> - <Subcode>   <Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:DestinationUnreachable</Value>   </Subcode>   </Code> - <Reason>   <Text xml:lang="en-US">The message with To 'http://localhost:9409/PPInfo.svc/ReadResponse?RESULT=0&AUTHCODE=10001&RESPMSG=APROVED&PNREF=12345' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.</Text>   </Reason>   </Fault> // web.config  <system.serviceModel>     <behaviors>       <servic

Dataview filter on querystring parameters - how to return all when empty?




I'm creating a page with a dataview wepart. The dataview is filtered by three querystring parameters. This works fine as long as all parameters are present in the querystring. The parameters currently all have defaultvalue set to "". If one parameter is missing from the querystring, the dataview returns no results (no column values matches "" they all have values). I would like it to return all results if the parameter is not present, does anyone know how to do this?


The dataview is displaying items in a Sharepoint list and currently the filter uses "equals" because I'm filtering on a MultipleLookup field type. 


I would really like to see a wildcard character in CAML like I can use % when I do this for a dataview with a sql server datasource.





Odd QueryString parameters


Hi all.

I have a partial view that implements a search box in my MVC site. The code looks like this:

<form action="/Search" method="get" id="searchForm">
    <%= Html.TextBox("t", null, new {@name = "t"}) %>
    <input id="searchimg" type="image" src="/Content/search.png" value="Search"
        title="Search" />

What I want is to get a URL with something like this when the user clicks the search image:


The thing is, that besides the QueryString parameter "t" that ASP.NET MVC creates according to my code, I'm getting two additional parameters, "x" and "y", which I have no idea where they're coming from or what good they serve, so, instead, I'm getting this:


Any thoughts? I haven't touched my default routes, by the way.


<form action="/Busqueda" method="get" id="searchForm">

SqlDataSource WHERE Parameters - QueryString and Default value not working correctly?


This is really easy, but I can't seem to get this working correctly...


When using SqlDataSource and press on Configure Data Source, I have selected my data source.

I have selected * all records and pressed the WHERE button  (so it starts to bulld a query).



I have set the following values:


Column: NewOrUsed (only contains 1 of 2 values, either "New" or "Used")

Operator: =

Source: QueryString

QueryString Field: (Eval("NewOrUsed").ToString)

Default Value: New



However it doesn't seem to work, always returns no records even though I know there are a number of records matching "New"



What am I doing wrong?

Linq: how to share parameters between lambda expressions ?

When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it's not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not visible from one method to another.
The compiler is using two technical different ways to let parameters go out of a method.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

view state vs request parameters


If  the view state is the data entered into the form fields then they are supposed to be available in the request parameters or request body. Then why would we need view state for?


FormView -- Parameters and asp:Table


I've already solved this problem to my satisfaction, I just want to know WHY it works this way.

I have a FormView control bound to an ObjectDataSource.  Let's say our data source is a hypothetical table with three columns:  id, name, age.  Why is it that when I use the <asp:Table> element inside of the FormView, the parameter values are not set, but when I use the standard <table> tag, it works fine?

This seems like a .NET problem to me.  I expect the <asp:Table> element to work in the same way as <table> because they are, for all intents and purposes, the same thing.  Am I missing something?

linqdatasource parameters question



I'm currently getting to know the linqdatasource control. What would happen if several WHERE parameters are added to the linqdatasource control declaritively in the aspx page but no WHERE clause is defined? 

1. is there any issue with setting up multiple WHERE parameters in the aspx markup for linqdatasource but then deciding which ones actually get used at runtime by setting the actual WHERE clause at run time? Would the unused parameters simply be ignored and cause no issues?

2. when you need to modify WHERE clause or WHERE parameters at runtime do you need to do so in an event handler? such as linqdatasource.selecting?
I see from the above link it is possible, but is that the standard way to handle controlling filtering in code behind for linqdatasource?

2b. if you use an event such as linqdatasource.selecting to add where parameters and/or modify the where clause in code will that also break the builtin sorting and paging support of the linqdatasource with a gridview? 

Arabic QueryString with Url Rewrite Solution


Alsalamo 3alaykom ,

as we know that if you use Intelligencia.UrlRewriter.RewriterHttpModule or IIS URL Rewriting , we will face problems with arabic urls

as this

http://localhost:1234/Pages/???? ?????? ?????? ??????????

and the Rule is :

<rewrite url="~/Pages/(.+)" to="~/ShowPages.aspx?Page=$1" />

you will recive the QueryString["Page"] Like this

نائب العميد للشؤون الأكاديمية

so it's a big problem , and there is a solution that is :

remove the Rule of that rewriting ,,

<rewrite url="~/Pages/(.+)" to="~/ShowPages.aspx?Page=$1" />

then open your Global.asax file and Application_BeginRequest method exactly

use the following code to handle you request

void Application_BeginRequest(object sender, EventArgs e)
if (HttpContext.Current.Request.Url.ToString().Contains("/Pages/"))
	String[] txt= Regex.Split(HttpContext.Current.Request.Url.ToString(), @"/");
	String page = txt[txt.Length-1];

Showing filtered Records in Crystal Report as per User Requirement


ReportDocument reportDocument = new ReportDocument();
    ParameterField paramField = new ParameterField();
    ParameterFields paramFields = new ParameterFields();
    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            paramField.Name = "@Ext";
            //*Remember to reconstruct the paramDiscreteValue and paramField objects
            paramDiscreteValue.Value = 44854
            CrystalReportViewer1.ParameterFieldInfo = paramFields;

Optional named parameters work pretty well

Rob has found a use for dynamic: http://blog.wekeroad.com/2010/08/06/flexible-parameters-with-csharp Yay! Let's celebrate! Well, I was a little puzzled because I don't think it quite adds up in the specific example he chose (although please see no aggressiveness here: Rob's a friend; peace!). The idea is to have the same flexibility that a dynamic language can offer in terms of evolution of an API. Here's his original Ruby example: def my_method(args)   thing_one = args["thing1"]   thing_two = args["thing2"] end my_method :thing1 => "value", :thing2 = Time.now The idea, which is quite common in dynamic languages, is that instead of passing a list of predetermined parameters in a specific order, you...(read more)

SqlDataSource and Parameters query


Hi everyone,

I'm on the edge wondering is it possible ? I have got 2 questions. Please help me out.

1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like

SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.

Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).

2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query

(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).

If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.  I am stucked and desparately looking for help. Thanks all.

WCF DataService - Global Parameters


Greetings.  I am searching for a way to provide a couple "global" parameters to my WCF DataService.

What I would like to be able to do is set a couple properties on the server which will be held onto by the server for future queries by the client. 

For example, it would be great when I create my client if in the constructor I can just say: 

MyDataService service = new MyDataService("http://somurl/myservice.svc?param1=value1¶m2=value2


 I can then use param1 and param2 when a client calls my service and use QueryInterceptors to provide filters to the queries.  I want to avoid having to write custom WebGet methods.

If there is a way to accomplish this; great!

If there is a way to accomplish this with just 1 call; even better!

Passing Parameters through sub reports



I am trying to use a parameter field where there is a subreport in my main report but i keep getting the error "subreport cannot be shown" when running the report. Any ideas please.

p.s - I have just set the parameters the same in the subreport as the main report.



Passing report parameters by report viewer


I have 4 parameters in which 3 are passed in report and 1 is passed through report viewer. I have made a parameter in SSRS called CandidateId to which I want to pass the value. The code for report viewer is:

 intReportID = Convert.ToInt32(Request.QueryString["ReportID"
 CandId = Convert.ToString(Session["CandidateId"
lblReportName.Text = dtReport.Rows[0]["ReportName"
SSRSReportViewer.ShowCredentialPrompts =false

 SSRSReportViewer.ServerReport.ReportServerCredentials = new
SSRSReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.


 SSRSReportViewer.ServerReport.ReportServerUrl = new

SSRSReportViewer.ServerReport.ReportPath = dtReport.Rows[0]


 Microsoft.Reporting.WebForms.ReportParameter[] theparams = new

theparams[0] = new
, CandId);
theparams[0].Visible = false
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