473,508 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2.0: DataList with nested LinkButton

Hello,
Please help me in simple problem. I defined DataList, FooterTemplate
with nested asp:LinkButton, and command handler procedure:

<asp:DataList ID="BooksList" runat="server"
OnEditCommand="BooksList_Edit"
OnUpdateCommand="BooksList_Update"
OnCancelCommand="BooksList_Cancel"
OnDeleteCommand="BooksList_Delete">
...
<FooterTemplate>
</tbody>
<tfoot>
<tr align="justify">
<td>
<asp:LinkButton ID="BooksLisAdd"
runat="server" Text="Add" CommandName="Add"
OnCommand="BooksListAdd_Add" />
</td>
</tr>
</tfoot>
</table>
</FooterTemplate>
</asp:DataList>

protected void BooksListAdd_Add(object sender, CommandEventArgs e)
{
...
BooksListAdd.Visible = false; // HERE ERROR: "The
name 'BooksListAdd' does not exist in the current context."
}

Could you explain me please the error and how to solve it?
Thank you very much
/RAM/
Jun 27 '06 #1
3 4002
I haven't used a DataList before but you will have to do something along the
line of:

LinkButton linkButon =
(LinkButton)DataListMain.FindControl("LinkButtonAd d");
linkButon.Visible = false;

The control does not exist at compile time so you can't directly reference
it.

Hope this helps,

"R.A.M." <r_********@poczta.onet.pl> wrote in message
news:c8********************************@4ax.com...
Hello,
Please help me in simple problem. I defined DataList, FooterTemplate
with nested asp:LinkButton, and command handler procedure:

<asp:DataList ID="BooksList" runat="server"
OnEditCommand="BooksList_Edit"
OnUpdateCommand="BooksList_Update"
OnCancelCommand="BooksList_Cancel"
OnDeleteCommand="BooksList_Delete">
...
<FooterTemplate>
</tbody>
<tfoot>
<tr align="justify">
<td>
<asp:LinkButton ID="BooksLisAdd"
runat="server" Text="Add" CommandName="Add"
OnCommand="BooksListAdd_Add" />
</td>
</tr>
</tfoot>
</table>
</FooterTemplate>
</asp:DataList>

protected void BooksListAdd_Add(object sender, CommandEventArgs e)
{
...
BooksListAdd.Visible = false; // HERE ERROR: "The
name 'BooksListAdd' does not exist in the current context."
}

Could you explain me please the error and how to solve it?
Thank you very much
/RAM/

Jun 27 '06 #2
On Tue, 27 Jun 2006 06:17:37 -0700, "Andrew Robinson"
<ne****@nospam.nospam> wrote:
LinkButton linkButon =
(LinkButton)DataListMain.FindControl("LinkButtonA dd");


There's no method FindControl for data list object.
I tried this.FindControl but I got NullReferenceException.
Do you know how to write it?
Thank you very much
/RAM/
Jun 27 '06 #3
On Tue, 27 Jun 2006 16:03:31 +0200, R.A.M. <r_********@poczta.onet.pl>
wrote:

There's no method FindControl for data list object.

There is.
Thanks.
Jun 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2186
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to display in datalist if datafield "is_measure_customchecklist" in a db table set to true. Here is the code (in parts): ...
10
2820
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
1
2210
by: AndrewR | last post by:
Hey all, Have a strange one here I don't understand.... I have a DataList control in an .aspx page. Inside the DataList's <ItemTemplate> is a single LinkButton control. On the initial page...
4
2615
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to be visible in datalist only on the condition when datafield "is_measure_customchecklist" in a db table set to true. Here...
1
2922
by: Craig | last post by:
This is killing me, I've been trying to figure this out for 2 days. When I click on the linkbutton, it executes the GetData(int) method to set the DataSource. The FAILURE is when it tries to...
2
1493
by: Laura K | last post by:
I would like to create a nested datalist inside the selecteditemtemplate of a datalist. My hope is that when a user clicks on a link a set of child links is displayed. For example if the user...
3
10280
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template...
0
1142
by: R.A.M. | last post by:
Hello, Please help me in simple problem. I defined DataList, FooterTemplate with nested asp:LinkButton, and command handler procedure: <asp:DataList ID="BooksList" runat="server"...
3
2794
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.