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

Catching buttons in repeaters

*google wont let me post to
microsoft.public.dotnet.framework.aspnet.webcontro ls so thats why i
posted here*

I have a repeater that i want to have an ImageButton and a linkbutton
in.

I catch the click in the repeater using OnItemCommand=" to run a sub.

I then cast to a button to check the CommandName=" and do what ever
the button is meant to be doing.

However when it comes to the cast i have to use

Dim command As String = CType(e.CommandSource, linkButton).CommandName

but when i added the imagebutton to the repeater and knocked the cast
back to

Dim command As String = CType(e.CommandSource, Button).CommandName

It fails; i get a "Specified cast is not valid" error.

<asp:button> <asp:Linkbutton> <asp:Imagebutton> all inherit from
System.Web.UI.WebControls.WebControl this seems like a fairly bad way
of going about things! I would have a general button class, and
specialise it :(

Whats even weirder (to me anyway) is linkbutton comes off
System.Web.UI.WebControls.Image

Anyway where do i go from here? do i just have to do lots of "try
catch" to sort out which TYPE of button the user clicked, then check
the command name then do the action?

Thanks for any ideas

Fragg
Nov 17 '05 #1
0 1017

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

Similar topics

0
by: David B | last post by:
Bare with me this is my first post. Objective: To dynamically create repeaters in a WebForm based on sets of data. Problem: When I attempt to create any Repeater from C# I get a big fat white...
3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
2
by: Jorge Ayala | last post by:
Well I'm trying to catch and act upon a button event that is placed within the item template of a repeater control. Yet the code I'm using isn't working. What I've seen out there to explain how...
0
by: Paul | last post by:
I want to be able to nest a repeater in a datagrid or datalist. I'm not unduly bothered about a master/child relationship as such as there'll at this stage only ever be one record on the page, but...
0
by: Machi | last post by:
let say in parent-child scenerio (Product: Product Category - one product category may has many products), i am using nested repeaters where parent repeater will be used to display info and child...
1
by: garethdjames | last post by:
Please can some on offer some practicle advice, I am designing a page that displays details about a product, the page will be navigated from a datagrid (this bit no problem), The details page...
5
by: lord.zoltar | last post by:
How can I prevent the big close button in the top of the window from closing the window? I want to have and "are you sure?" confirmation so the user must press "Yes" before the program ends. Right...
1
PrinsonG
by: PrinsonG | last post by:
My Query is How do I export to excel/csv using Nested Repeaters. My project is web-based and i am using C#.Net. In this i use three repeaters. one displays ID, Name of the user. second...
1
by: andrew.douglas11 | last post by:
Hello all, Is it possible to share controls inside a child repeater? Here's the situation: I have a web page that needs to display data grouped by A, and alternatively by B (only one grouping...
3
by: Leon Mayne | last post by:
If I have a datatable which looks like this: Record Id, Group Id, Name 1, 1, Test 1 2, 1, Test 2 3, 2, Test 3 4, 3, Test 4 Is it possible to use nested repeaters to group the information by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...

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.