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
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