none
Guid Parameter in LINQDataSource RRS feed

  • Question

  • Thanks for your help in advance!!! I've been banging my head on the wall for 2 days trying to figure out what I'm missing.  I've tried many things... these are the latest ideas...

    I would like to use a value in a BoundField of a GridView as the parameter for a LINQDataSource which populates another GridView.  The Value in the Parent GridView is a Guid. 

    This is my LINQDataSource:

    <

     

    asp:LinqDataSource ID="LocationLinqDataSource" runat="server" ContextTypeName="SoftwareCustomerDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" OrderBy="LocationName" TableName="Locations" onselecting="LocationLinqDataSource_Selecting" Where="CustomerID = @CustomerID" >
    <WhereParameters>
          <asp:ControlParameter ControlID="GridView1" Name="CustomerID" PropertyName="Columns[2]" Type="Object" />
    </WhereParameters>
    </asp:LinqDataSource>


    when I couldn't get the above to work I tried this in the _Selecting event.

     

    Parameter whereParam = new Parameter();
    whereParam.Name =
    "customerID";
    whereParam.DefaultValue =
    "00000000-0000-0000-0000-000000000000" ;
    whereParam.Type =
    TypeCode.String;
    LocationLinqDataSource.WhereParameters.Add(whereParam);
    LocationLinqDataSource.Where =
    "CustomerID == @customerID";

    That didn't work either.... 

    Monday, November 2, 2009 8:22 PM

Answers