Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2004, 07:22 AM
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


 
Old April 3rd, 2004, 11:17 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Where/when are you trying to get the values out? You haven't detailed this so it's hard to provide an answer.
 
Old April 4th, 2006, 10:11 PM
Registered User
 
Join Date: Nov 2003
Location: Canton, OH, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hadware Send a message via Yahoo to Hadware
Default

Hello,
I also have a datagrid inside of a datalist where I am trying to fill the datagrid with the key from the datalist.

The datagrid is in the edititemtemplate. I fill the datalist with a dataset first, then clicking on the linkbutton for editing I would need the datagrid to fill.

Where would I do this?

thank-you,
Eric
 
Old April 4th, 2006, 10:45 PM
Registered User
 
Join Date: Nov 2003
Location: Canton, OH, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hadware Send a message via Yahoo to Hadware
Default

Here's what I have so far...
    Sub DataList_EditCommand(ByVal sender As Object, ByVal e As DataListCommandEventArgs)
        DataList1.EditItemIndex = e.Item.ItemIndex
        Dim thegrid As DataGrid
        Dim intID As Integer
        intID = DataList1.DataKeys(e.Item.ItemIndex)
        thegrid = CType(e.Item.FindControl("DataGrid1"), DataGrid)
        Dim queryString As String = "displayadscreditsearnedfrom " & intID
        Dim cmd As New SqlCommand(queryString, connect)
        connect.Open()

        Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(cmd)
        Dim data As DataSet = New DataSet
        thegrid.DataSource = data
        thegrid.DataBind()
        connect.Close()
    End Sub

It tells me I cannot convert to double.




Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownButton inside datagrid strange problem wakeup General .NET 1 February 15th, 2008 02:29 AM
Datalist inside datalist amit.jagtap ASP.NET 2.0 Professional 1 September 4th, 2007 05:03 AM
How to get to controls inside DataList? rsearing ASP.NET 2.0 Basics 1 March 1st, 2007 09:14 AM
Problem with datagrid insida a datalist hoeknu Classic ASP Basics 0 March 31st, 2004 05:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.