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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

editable datagrid

Status
Not open for further replies.

ludmann

Programmer
Apr 14, 2004
49
GB
I have a datagrid that is linked to an ArrayList custAddress.
A typical column looks like this. I also have an add button in the FooterTemplate, and on OnItemCommand = "doInsert" a new item is added to the ArrayList custAddress, which is also reflected in the datagrid.

<asp:TemplateColumn>
<HeaderTemplate>
<asp:Label id="city" runat="server">City
</asp:Label>
<asp:Label id="city"
</HeaderTemplate>

<ItemTemplate>
<% # DataBinder.Eval(Container.DataItem, "City")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox width="55" ID="add_city" Runat="Server" />
</FooterTemplate>
</asp:TemplateColumn>

I want to take this a step further and in my aspx I want the datagrid to display as it is, if there is no parameter attached to the URL and want the datagrid to display in edit mode if there is a parameter attached to the URL.

1. Question. Can I do this? Have a condition within the html to say if prm = null display the datagrid like this, else display that datagrid like that

If yes how?

2. Question. How can I make the datagrid editable? Basically it is bound to the ArrayList, and I want this ArrayList to display within the datagrid so it is editable and when I edit it, I want the ArrayList to update.

Can I do this? and how?

Marika
 
i've made a custom control called editable datagrid which contains textboxes instead of simple table cells where the user can add or modify the existing values. also with a bit of javascript I managed to make the grid create a new row or delete one if the user chooses so. but it's quite some work to do.

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top