WebGrid Community Server

Welcome to WebGrid Community Server Sign in | Join | Help
in Search

how to set dinamic filter for foreignkey columns?

Last post 08-20-2008, 16:32 by benerdin. 3 replies.
Sort Posts: Previous Next
  •  08-07-2008, 0:57 719

    how to set dinamic filter for foreignkey columns?

    Hi to all,

    first of all my congratulation for this software: I' trying to understand it but it seems to be very powerful.

    I have this problem:

    In my Web application i stored in a variable named "number" inside the Application.contents the value (for example 5) I want to use as filter in order to limit the items to be showed in a combo actually containing all the employees of the Northwind database table Employees, for example only those having ID less than number.

    Is it possible? For the moment I've only succeded in setting the where property of the column using a fixed valued (id <= 7) but I've yet no idea about the way to use the alue contained in the number variable: I tried to use this sintax (id <= application.get("user") ) but I got errors.

     

    Somone can help me please?

     

    Bye

     

     

     

     

     

     

     

  •  08-11-2008, 18:21 728 in reply to 719

    Re: how to set dinamic filter for foreignkey columns?

    Please see starter kit for this. The property you should use for this is 'Where' statement. Which can be used at grid, and columns (forteignkey and many-to-many)

    Olav Botterli, WebGrid Founding Developer
  •  08-20-2008, 1:27 740 in reply to 728

    Re: how to set dinamic filter for foreignkey columns?

    Yes Olav,

    I saw the where statement.

    But I can't understand the syntax I've to use in order to set the where criteria using a value stored in the Application.contents of my application (for example, the value "7" stored in the application.contentes with the name "number"!!!!!!!!!!

    I can't find such an example for this in starter kit.

    Could you suggest me where looking for, please?

    Bye and thank again

  •  08-20-2008, 16:32 741 in reply to 740

    Re: how to set dinamic filter for foreignkey columns?

    Try something like this in your actual code

    pageGrid.Where = String.Format("id <= {0}", Application.Contents["number"]);

    I'm assuming "id" is the field you're comparing to "number".

    Hope that helps.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems