Insert row to a datalist
Hi,
I want to insert a row to a datalist when entering a web page. In order to databind the datalist, now I need to insert a blank record into the database before performing the databinding. By using this method, I need to remove the blank record from the database if user wants to cancel the job. It will not only increase the traffic between client and server, but also remain unused record in DB if the removal is not successful. So would you please suggest me how could I add a row to the datalist without adding blank record in DB?
Thank you very much.
[576 byte] By [
THL] at [2007-11-11 7:21:28]

# 1 Re: Insert row to a datalist
I would create an unbound DataList containing the blank item and position it directly below the bound DataList so they appear as a single list.
# 2 Re: Insert row to a datalist
Thanks Phil Weber,
You mean there are two datalists, one is bounded and the other is unbounded. So, when user enters the web page, I need to check something to determine which datalist should be displayed, is it right?
But is it possible that I re-use the bounded datalist (so there is only one datalist), but do not perform the databinding when first entering the web page?
THL at 2007-11-11 23:14:52 >

# 3 Re: Insert row to a datalist
Sorry, perhaps I misunderstood. I understood that you always want to display the bound DataList, but want to display an additional blank item when the page first loads.
If you simply want to display the same DataList all the time, sometimes bound and at other times unbound, that's no problem. Simply leave the list unbound at design time and conditionally bind it in the Page_Load event.
# 4 Re: Insert row to a datalist
Yes, Phil Weber, that is what I want. But, I try to bound the datalist during design time, and try to unbound all items when needed. I could not find the syntax to unbound the item!!! Is there any syntax to use?
Thanks again.
THL at 2007-11-11 23:16:51 >

# 5 Re: Insert row to a datalist
Please re-read my previous post: Leave the DataList unbound at design time, then bind it at runtime if desired.