Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I have a Image Upload control and caption textbox and an add button.
When I click the add button image and caption added to the gridview. There is no limit by adding the image and caption to the gridview.

Please help me.
Posted
Updated 9-Mar-11 22:56pm
v3

So whats the big deal. Take a grid view with 2 Template columns. First with label and other with Image control.

No at the add button click you will save the image some where. After that store the Caption and Image URL in some data table or any collection and bind it to the grid.

That should be it.
 
Share this answer
 
Comments
Albin Abel 10-Mar-11 5:26am    
Simple solution. My 5
Wild-Programmer 10-Mar-11 5:30am    
Thanks Albin :)
The steps involved are

1) Post the image and keep the image in a static dictionary or save to hard disk. Static dictionary will increase the load in sever memory, but perform fast. The hard disk method little slower, but no memory pressure.

2) Create a http handler which parse the image bytes and send to the output stream. The request parameter you send to this handler should identify the image in the hard disk.

3) Add a new row in the underlying table for the gridview where a column represented as item template with a image in it. Assign a new image to that column index in the new row and set the image url to the handler with query string parameter to identify the image.

4) Bind the gridview.

Now you need to google for each step. 1) How to save an uploaded image 2)How to create a custom handler 3)How to handle a datatable 5) How to create item templates in gridview.

Try!. If stuck post your queries.
 
Share this answer
 
Comments
Albin Abel 10-Mar-11 5:28am    
Hi the handler step not necessary if you store the image in the hard disk. You can bind it using its url path. The handler is necessary when store the image in database or the image bytes in memory. Look at Amit Kumar Tiwari's solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900