Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show or hide new row in the middle of a gridview?

Status
Not open for further replies.

wbodger

Programmer
Apr 23, 2007
769
0
0
US
I have an extranet page where a user will click on the part number being displayed in a gridview and I want to show them the detail for that part number between the row they clicked on and the next row down. What is the best way to do that: Update panels, CSS with a simple show/hide, some other new way I am not aware of? And then, is there any decent sample code for any suggested solutions?

Thanks,
Willie
 
I am confused on what you want to do. You have a gridview that has a part number column in it. That is a link to the detail of that part. So I would assume that would show the detail of the part number clicked?
It is hard for me to viualize what you are describing and why you would want to do it? Can you explain a little further?
 
We have a customer that is both a customer and a vendor (they supply the material, we create the product and send it back to them). This customer needs to be able to see not only what we have on hand, but what jobs that will cover and when we will need more of each particular material. To this end we have a portal (or extranet) where this customer can login and see their entire list of materials. When they then click on a material (the part number earlier) they will see the full detail of jobs requiring that material, how much material we have, how much each job needs and when we will run out with out current inventory.

Code:
Fabric P/N 	Description 	Qty Alloc To Wip 	Qty On Hand 	UOM 	Future Free 	Add/View Status 	Fabric Scan
 160103150AMI 	 "ADB" LEATHER 	 18.15 	 124 	 SQF 	 105.85 	Add / View Status 	 
 160103160AMI 	 "ADJ" LEATHER 	 0 	 20 	 SQF 	 20 	Add Status 	 
 160103200AMI 	 "ADM" LEATHER 	 0 	 457 	 SQF 	 457 	Add Status

and then expanded for one material

Code:
 160103150AMI 	 "ADB" LEATHER 	 18.15 	 124 	 SQF 	 105.85 	Add / View Status 	 
Buyer Name	Po#	Description	Delivery Date	F/G Part #	Qty To Make	Qty Required	Running Summary
M.SOMENAME	10102029 	SEAT KIT 	5/28/2013	2D7004-71ADB 	5	14.5	14.5
M.SOMENAME	10441450 - AFTERMARKET 	COVER ASSY 	6/4/2015	2D7017-14ADB 	1	6.15	20.65
M.SOMENAME	10437916 - AFTERMARKET 	COVER ASSY 	6/5/2015	2D7071-11ADB 	2	12	32.65

Fabric Receipts
EntryDate	PO	Qty
3/19/2015	RTC 608 	-35.000
1/12/2015	10371219 	350.000

Is that a little more clear now? If you have suggestions for another way to handle this I would be happy to hear them.

Thanks,
wb
 
Ok so the top block of "code" you are showing what you currently have in your gridview, correct?
So now, if the user clicks on a link in the "Fabric P/N" column (i.e. "160103150AMI"), then you want to see the expanded view in your second "code" block? Is that correct?
 
Yes, that is correct and I always want the second block to show up directly below the first block, like it was inserted in there.

Thanks,
Willie
 
There are a couple of options.
If you have a 3rd party control, like Telerik controls, they make this easy with their RadGridView.

If you just want to use the stock gridview, you can have a template column and put another gridview in it (so it would be nested)
On rowdatabound, you use FindControl() and bind that grid. (Or you can just use a div or repeater or whatever control you like)

Also, on rowdatabound, you use FindControl() to find the link and attach a javascript "onclick" event to it to call a function.
That function will just show that control using javascript or JQuery(my preference)
 
I got this working using nested gridviews. Thank you for the help!

wb
 
Yep, that would be a good way to go. Repeaters or listviews are good too if you need to have it look a certain way because
you can generate any HTML layout you want.

Glad to help.
 
I did get this working with nested gridviews, thanks for your help!

wb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top