473,408 Members | 2,009 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,408 software developers and data experts.

arguments in functions/buttons

hi there, I am using c#, not quite sure how to get an argument into an event.

protected void btnRedirect_Click (object sender, eventargs e) {

go to url newpage?id=[id i passed]

}
i know sender is whatever control invoked this code (e.g. button) but not
sure what the eventargs is for. I have a button which performs a click event.
But I want to send a value to the click event (an id to be passed in an url
redirection). How do I put this string into the argument list of the click
event?

I am also trying to put the id into the click in the html and this is
returning an error (asp server control not formed). The value I want to pass
comes from an asprepeater. what am i missing in the following?

<asp:ImageButton id="btnNext" ImageURL="~/images/but_next.gif" height="17px"
width="48px" onclick="btnViewClient_Click(<%#
DataBinder.Eval(Container.DataItem, "ClientID") %>)" runat="server"/>

Thank you.
Nov 18 '05 #1
1 935
Don't do this with a normal button. Use a CommandButton instead. Then you
can set the CommandText property of it to whatever you want and access it
through the event handler.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"louise raisbeck" <lo************@discussions.microsoft.com> wrote in
message news:C7**********************************@microsof t.com...
hi there, I am using c#, not quite sure how to get an argument into an
event.

protected void btnRedirect_Click (object sender, eventargs e) {

go to url newpage?id=[id i passed]

}
i know sender is whatever control invoked this code (e.g. button) but not
sure what the eventargs is for. I have a button which performs a click
event.
But I want to send a value to the click event (an id to be passed in an
url
redirection). How do I put this string into the argument list of the click
event?

I am also trying to put the id into the click in the html and this is
returning an error (asp server control not formed). The value I want to
pass
comes from an asprepeater. what am i missing in the following?

<asp:ImageButton id="btnNext" ImageURL="~/images/but_next.gif"
height="17px"
width="48px" onclick="btnViewClient_Click(<%#
DataBinder.Eval(Container.DataItem, "ClientID") %>)" runat="server"/>

Thank you.

Nov 18 '05 #2

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

Similar topics

9
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this...
12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
7
by: A. Saksena | last post by:
Hi all, Is it possible to write a function or a macro in C++, which is capable of accepting any number of arguments. To give an example, the following should be possible: - ...
6
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed...
30
by: Will Pittenger | last post by:
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are...
16
by: Martin Jørgensen | last post by:
Hi, Problem: ======== Some of my output functions are beginning to take pretty many arguments... I mean.... We're talking about 10-15 arguments :-) So I thought to myself, perhaps this is...
4
by: mantrid | last post by:
Hello Hope you can help. I have been using the code below to move elenents around the page. This has worked fine until I put some arguments into the functions so I could use them in many places...
7
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the...
10
by: Armando Serrano Lombillo | last post by:
Why does Python give an error when I try to do this: Traceback (most recent call last): File "<pyshell#40>", line 1, in <module> len(object=) TypeError: len() takes no keyword arguments but...
1
by: AdamGr | last post by:
Using tkinter, how does one add arguments to functions called by buttons? For example I have the line: b = Button(parent, command = self.login) but what if self.login has parameters, like...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.