473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Prob w/ Datagrid

I have a Datagrid with the following code:

<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("id") %>'
runat="server" OnClick="LinkButton1_Click">Details</
asp:LinkButton>Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

I'm getting this error message:
Compiler Error Message: BC30456: 'LinkButton1_Click' is not a member
of 'ASP.MainDepartment_aspx'.

Everything looks k in the design view.
What are some places I should think of looking? BTW I'm using .NET 1.1

Thanks!!!
Jun 30 '08 #1
6 1335
On Jun 30, 9:11*am, brock wade <brockusw...@yahoo.comwrote:
I have a Datagrid with the following code:

<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("id") %>'
runat="server" OnClick="LinkButton1_Click">Details</
asp:LinkButton>Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

I'm getting this error message:
Compiler Error Message: BC30456: 'LinkButton1_Click' is not a member
of 'ASP.MainDepartment_aspx'.

Everything looks k in the design view.
What are some places I should think of looking? BTW I'm using .NET 1.1

Thanks!!!
Is there a 'LinkButton1_Click' member in the code-behind?
Jun 30 '08 #2
Another item that may shed some light:

I have this to handle the button in my code-behind:

Private Sub LinkButton1_Click(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs )
Response.Redirect("Details.aspx?id=" & ID.ToString())
End Sub

On Jun 30, 12:11*pm, brock wade <brockusw...@yahoo.comwrote:
I have a Datagrid with the following code:

<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("id") %>'
runat="server" OnClick="LinkButton1_Click">Details</
asp:LinkButton>Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

I'm getting this error message:
Compiler Error Message: BC30456: 'LinkButton1_Click' is not a member
of 'ASP.MainDepartment_aspx'.

Everything looks k in the design view.
What are some places I should think of looking? BTW I'm using .NET 1.1

Thanks!!!
Jun 30 '08 #3
On Jun 30, 10:30*am, brock wade <brockusw...@yahoo.comwrote:
Another item that may shed some light:

I have this to handle the button in my code-behind:

* * Private Sub LinkButton1_Click(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs )
* * * * Response.Redirect("Details.aspx?id=" & ID.ToString())
* * End Sub

On Jun 30, 12:11*pm, brock wade <brockusw...@yahoo.comwrote:
I have a Datagrid with the following code:
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("id") %>'
runat="server" OnClick="LinkButton1_Click">Details</
asp:LinkButton>Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
I'm getting this error message:
Compiler Error Message: BC30456: 'LinkButton1_Click' is not a member
of 'ASP.MainDepartment_aspx'.
Everything looks k in the design view.
What are some places I should think of looking? BTW I'm using .NET 1.1
Thanks!!!
The LinkButton1 method has the wrong signature and you are not using
the correct event. Below is the corrected code:

Private Sub LinkButton1_Click(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
Response.Redirect("Details.aspx?id=" &
e.CommandArgument.ToString())
End Sub

<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("id") %>'
runat="server" OnCommand="LinkButton1_Click">Details</
asp:LinkButton>Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

There are 3 changes.
1: Instead of using OnClick, use OnCommand. Otherwise you dont get
easy access to the command argument.
2: Change the method signature to the one for the OnCommand event.
3: Change the method to get the id from the command argument instead
of ID. I have no idea where ID came from.

Note: I left the method name alone, but now its confusing. I would
change it to be something like ViewDetails. Something descriptive.
Hope this helps!
Jul 1 '08 #4
On Jun 30, 8:30 pm, brock wade <brockusw...@yahoo.comwrote:
Another item that may shed some light:

I have this to handle the button in my code-behind:

Private Sub LinkButton1_Click(ByVal source As Object, ByVal e As
Norm is right, the method has the wrong signature.
Just one addition to his suggestion:
You can't access private methods in the code-behind. They have to be
protected at least.

Mykola
http://marss.co.ua
Jul 1 '08 #5
Yeah I thought that might have been it from other similar BC30456 "is
not a member" posts, but changing to either Public or Protected did
not work.
>
Thanks Marss I didn't notice that. Wade, read Marss post above. The
reason that it is still throwing the error is becase it can't see it.
Change "Private" to "Protected" or "Public".- Hide quoted text -

- Show quoted text -
Jul 1 '08 #6
On Jul 1, 12:42*pm, wade.br...@yahoo.com wrote:
Yeah I thought that might have been it from other similar BC30456 "is
not a member" posts, but changing to either Public or Protected did
not work.
Thanks Marss I didn't notice that. Wade, read Marss post above. The
reason that it is still throwing the error is becase it can't see it.
Change "Private" to "Protected" or "Public".- Hide quoted text -
- Show quoted text -
Well, I don't know what else to say other than post the full source of
this page. There must be something else going wrong.
Jul 1 '08 #7

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

Similar topics

2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
1
by: josephrthomas | last post by:
hi... can someone pls tell me how can i make a datalist or datagrid connected to MSAccess where i can load info to the datalist or the datagrid.. in the datalist or the datagrid, i need three...
0
by: Raghavendra | last post by:
hi, we r using forms authetication. problem :- i am using the below code to generate excel report but since we r using forms authetication.. after generating excel report the browser directs...
15
by: John Blair | last post by:
Hi, Code attached but the line that gives me an error is MyDataGrid.Columns(2).Visible = False It actually gives me an error for any value instead of 2 even when 9 bound columns of data exist....
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
1
by: Marcel Sengers | last post by:
Hi folks. I have a problem with a Datatgrid. When my User selects a row in the Datagrid he is able to scroll through the Grid by using the Mousewheel. The prob is that when the selectedrow is...
2
by: harini | last post by:
i hv a datagrid to which i hv bound a table...i hv the table columns to be editable...i.e read only = false....now i hv a problem...in the table there seems to be a row at the end having no values...
1
by: firman89 | last post by:
I want to delete a record in datagrid through a button. The datagrid class itself supports deleting with delete key on keyboard, but I think it's much better if I could provide a button to perform...
0
by: SantoshKomarraju | last post by:
Help! i am using data grid control to display dynamic data in a windows application. To edit data in data grid cell i place text box dynamically . my prob is when i select edit cell using tab...
2
by: slinky | last post by:
I had a successfully deployed datagrid reading an XML file and showing the data: Private Function MakeDataView() as DataView Dim myDataSet As New DataSet()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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...
0
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...

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.