473,320 Members | 1,856 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,320 software developers and data experts.

Passing param to linkbutton

Hi, I want to create a datagrid with an extra column
containing a linkbutton. Clicking on the linkbutton
invokes a function and passes a parameter containing the
id of the row in question. I've been struggling with this
for a while now. Any help would be really appreciated!
See the code below.
The error I get is "The best overloaded method match for
OnDelete(long)' has some invalid arguments"
IN HTML:
<asp:datagrid id="grid" AutoGenerateColumns="False"
Runat="server">
<Columns>
<asp:BoundColumn DataField="UserName"
HeaderText="Name"></asp:BoundColumn>
<asp:templatecolumn>
<headertemplate>Delete Option</headertemplate>
<itemtemplate>
<asp:LinkButton id="lbtnDelete" Text="Delete"
OnCommand="CommandBtn_Click" CommandName="Id"
CommandArgument="<%# DataBinder.Eval
(Container.DataItem, "Id") %>" runat="server" />
</itemtemplate>
</asp:templatecolumn>
</Columns>

SCRIPT IN HEADER
<script language="C#" runat="server">
void CommandBtn_Click(object sender,CommandEventArgs e)
{
OnDelete(e.CommandArgument);
}
</script>
CODEBEHIND:
public void OnDelete(long id)
{
Delete(id);
}
Nov 16 '05 #1
0 1079

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

Similar topics

1
by: Eric Wagar | last post by:
I have a phpnuke website, and I use DigiChat chat. Since I have users who register, I'd like to be able to pass there username and email (at a minimum) into the chat system, so they do not have to...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
4
by: Alfred Taylor | last post by:
I essentially need a countif() function for xsl. Something to where I could do countif(node-set, condition). Rather than try to get too extreme, i decided to just write one for my countif() with...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
7
by: Cemal Karademir | last post by:
Hello, Please forgive my simple question, but i don't know the correct synatx. From the masterpage i want to put a text in an textbox and then select an item in the datagrid. I do know how to...
1
by: bill tie | last post by:
I create several link buttons based on database data. When a user clicks a link button, 1. I want to pass the value of the button as a parameter to an SQL query string; 2. suck more data out of...
12
by: dave_dp | last post by:
Hi, I have just started learning C++ language.. I've read much even tried to understand the way standard says but still can't get the grasp of that concept. When parameters are passed/returned...
6
by: David Schwartz | last post by:
I have a template that searches for and replaces found instances of strings in other strings and replaces them with yet another string. These strings are passed to the template as parameters, not...
8
by: asit | last post by:
How do I pass parameters to created thread..here is the code(but it can't pass data..it uses global variable) #include <windows.h> #include <stdio.h> DWORD Sum; DWORD WINAPI...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.