View Single Post
  #1 (permalink)  
Old March 31st, 2004, 07:22 AM
hoeknu hoeknu is offline
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with datagrid inside a datalist

Hi

I have I datagrid nested within a datalist, and my problem is that I can`t seem to find a way to get the values (using VB.NET) from the controls inside the datagrid. (textbox etc).
Can anyone please help?

Thanks.

Here is a code snippet from my aspx file:


<asp:datalist id="dataliste" Runat="server" CellSpacing="2" DataKeyField="emneId" OnEditCommand="endreKategori" OnDeleteCommand="slettKategori" OnCancelCommand="cancel">

<HeaderTemplate>
<b>Emner</b>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td>
<asp:LinkButton Text='<%# Container.DataItem("emne")%>' Runat="server" CommandName="Show" id="btnVisKat">
</asp:LinkButton>
<asp:Label Runat="server" id="lblEmne" visible="False" text='<%# Container.DataItem("emne")%>' >
</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:DataGrid Runat="server" id="datagrid" visible="False" AutoGenerateColumns="False" OnEditCommand="endreKlikk" OnCancelCommand="cancelKlikk" OnDeleteCommand="deleteKlikk" OnUpdateCommand="updateKlikk">

<Columns>
<asp:EditCommandColumn ItemStyle-Width="25px" EditText="<img border=0 Alt='Endre kategori' src=../../img/Edit.gif>" CancelText="<img border=0 src=../../img/Cancel.gif>" UpdateText="<img border=0 src=../../img/OK.gif>" />

<asp:ButtonColumn ItemStyle-Width="25px" Text="<img border=0 Alt='Slette kategori' src=../../img/Delete.gif>" CommandName="delete" />

<asp:TemplateColumn HeaderText="Kategori" HeaderStyle-Font-Bold="True" SortExpression="Kategori" ItemStyle-Width="150px">

<ItemTemplate>

<asp:Label id="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "kategori") %>' />

</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtEndreKategori" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "kategori") %>' Width="150px" />
<asp:RequiredFieldValidator Id="ValidateEditName" runat="server" ControlToValidate="txtEndreKategori" Display="dynamic">
* Kategori må fylles ut
</asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</ItemTemplate>
</asp:datalist>



Regards,
Knut