Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best pattern for Parent/Children UI design?
Message
 
To
26/03/2009 11:36:11
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01391176
Message ID:
01391685
Views:
52
>
>I don't want to see an actual "Select" item beside each Customer Name (that looks goofy). I want the Customer Name to be the link to click on.
>
>I have the ListView to present a list of CustomersWithOpenOrders. But, it's just a static list, so how do I make the Company Name label clickable, and what else will I need to make it fire back to some code-behind to fetch the child records. I already have a code-behind method to get child records for a passed-in CustomerNumber into a DataTable, and I think I would know how to bind that to a grid or listview, but I do not know how to pass the CustomerNumber from the ListView to the method from the UI form.

Edit the template for the list and make the company a LinkButton. Then store the CustomerNumber in the CommandArgument of it, ex:
<asp:LinkButton runat="server" Text='<%# Eval("CustomerName") %' CommandArgument='<%# Eval("CustomerNumber") %' OnClick="CustomerClick" /
Then add code in the code-behind for the event, retrieve the CustomerNumber from the CommandArgument and update the display.

ex.
protected void CustomerClick(object sender, EventArgs e)
{
     LinkButton button = sender as LinkButton;

     if (button != null)
     {
         string customerNumber = button.CommandArgument;
         // Update display
     }
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform