Monday, March 12, 2012

How to handle insert and ListBox from a GRID??

Please help me, Is it possible to do this from a grid?

Functionallity:
------
The grid will be populated from the database table TIME_JOURNAL.

The last line should be an empty line for adding new rows. Should I place this in the grid footer?.

The listbox (dropdown-list) should be populated from the database table TRANSACTION_TYPES.
So the user can change the transaction type. How should I do to populate the listbox?

To edit a cell the user should just click on it with the mouse pointer. How should I solve this?
I dont want an EDIT button on each line. Just click the cell to edit.

Delete button: Will delete current row.

Finish button:
Will take TIME_JOURNAL id for current row and start a stored procedure.
How do I reference the id? After this button is clicked the row should be green.
Can I reference every cell in a grid??

Is there any good examples?

Database tables:
TIME_JOURNAL
# IDNUMBER
# TYPE_OF_TRANS NUMBER (fk to TRANSACTION_TYPES ID)
# AMOUNT NUMBER
# DESCRIPTIONCHAR

TRANSACTION_TYPES
# ID NUMBER
# DESCRIPTION CHAR

Design
---------------------
| Listbox | TextBox | TextBox | Delete button | Finish button |
---------------------
| Listbox | TextBox | TextBox | Delete button | Finish button |
---------------------
| Listbox | TextBox | TextBox | Delete button | Finish button |
---------------------
| Listbox | TextBox | TextBox | Delete button | Finish button |
---------------------
| Listbox | TextBox | TextBox | Add button | (empty line for adding rows)
----------------

Regards,

MartinHi,

DataGrid & DropDownList Live demo :
Specifying a DataBound DropDownList in the EditItemTemplate

Adding a New Record to the DataGrid

To make empty line for adding new rows in the footer :


<asp:TemplateColumn HeaderText="DESCRIPTION"
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "DESCRIPTION") %>
</ItemTemplate
<EditItemTemplate>
<asp:TextBox ID="DESCRIPTION" Text='<%# Container.DataItem("DESCRIPTION") %>' Runat="server" />
</EditItemTemplate
<FooterTemplate>
<asp:TextBox ID="add_DESCRIPTION" Runat="Server" />
</FooterTemplate
</asp:TemplateColumn>

HTH
Thank you I think, I get it to work.

/m

Labels: , , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home