CodeSmith Community
Your Code. Your Way. Faster!

The generated admin pages do not pass ids.

Latest post 06-24-2008 4:54 AM by gordonj. 1 replies.
  • 06-24-2008 4:29 AM

    • gordonj
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 26
    • Points 530

    The generated admin pages do not pass ids.

    I have generated a project in Nettiers and the auto generated admin section has taken me 95% there!  My problem is that if I have a parent entity with a list of child entities in a gridview, I can't see how to pass the id from parent to child so that I can auto populate the appropriate drop down.

     For example:  A customer has a list of buyers.  When I add a buyer from a cutomer entity, I want to pass in the customer id and set it.  Seems trivial.

    In my CustomerEdit.aspx I have a MultiFormView containing Customer data followed by an EntityGridView of Buyers.  The "add new" URL is something like "~/admin/BuyerEdit.aspx".  I would like to add a query string something like "?customerid=<%# CustomerId %>".  This doesn't seem to work?

    Secondly.  On the BuyerEdit.aspx page,  I have a drop down list of cutomers.  Again this is a template user control.  Haven't used these much and they don't have a code behind!  I tried adding one but I cant access the control for some reason so I can't set it as I normally would (perhaps someone can tell me that this should work and that I probably made a mistake).  Again, I could do something like

    • ReadOnly='<%# (Request.QueryString{"CustomerId"] == null) ? false : true %>'
    • SelectedValue ='<%# (Request.QueryString{"CustomerId"] == null) ? String.Empty : Request.QueryString{"CustomerId"].ToString() %>'

    Again this doesn't work but it's probably my syntax as I am in unfarmilliar territory (Response.Write for the strings?).

     Can anyone help?  It's very frustrating.

     Thanks.

    Filed under: , ,
    • Post Points: 5
  • 06-24-2008 4:54 AM In reply to

    • gordonj
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 26
    • Points 530

    Re: The generated admin pages do not pass ids.

    May have solved the second part of my query by adding the following code to the Buyer datasource:

     

    <data:BuyerDataSource ID="BuyerDataSource" runat="server" SelectMethod="GetByCustomerId">

    <Parameters>

    <asp:QueryStringParameter Name="CustomerId" QueryStringField="CustomerId" Type="String" />

    </Parameters>

    </data:CompanyToCompanyTypeDataSource>

    The only unresolved issue there is how to conditionaly add the AppendNullItem and its text should I wish to.

     I still have not solved the issue of passing the id in the first place.

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems