473,503 Members | 9,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onclick in .net (vb) is undefined in datalist

When I click in a picture, I get a error the changePicture is undefined

<tr>
<td colSpan="2"><asp:datalist id="Picturelist" runat="server"
RepeatColumns="8">
<itemtemplate>
<img ID="Picture" height=100 width=100 onclick="changePicture"
runat="server" src='<%# DataBinder.Eval(Container.DataItem, "carPicture") %>'
/>
</itemtemplate>
</asp:datalist></td>
</tr>

Public Sub changePicture(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim item As DataListItem =
Picturelist.Items(Picturelist.EditItemIndex)
If (Not item Is Nothing) Then
Dim ddl As DataList = CType(item.FindControl("Picture"), DataList)
Dim check As String = ddl.SelectedItem.DataItem

Dim IDCar As Integer = CInt(Request.Params("CarID"))
Dim Maintenance As MaintenanceDB = New MaintenanceDB

Dim myCarDetails As MaintenanceDetails =
Maintenance.GetACar(IDCar)

Pictureheader.ImageUrl = myCarDetails.CarPictureHeader
End If
End Sub

Jul 21 '05 #1
2 1852
Stanley,

Did you know that there is as well an imagebutton which is in my opinion
very easy to use instead of the image for this..

In my opinion are better newsgroups for this kind of questions by the way
microsoft.public.dotnet.framework.aspnet
and
microsoft.public.dotnet.languages.vb

When you sent messages to both than that no problem when you do not know
what is better for your questions, you can send one message to both
newsgroups in one time (that is called crossposting). However do not send
two message to both one, that is hated by most people in newsgroups.

I hope this above helps anyway directly?

Cor

<tr>
<td colSpan="2"><asp:datalist id="Picturelist" runat="server"
RepeatColumns="8">
<itemtemplate>
<img ID="Picture" height=100 width=100 onclick="changePicture"
runat="server" src='<%# DataBinder.Eval(Container.DataItem, "carPicture")
%>'
/>
</itemtemplate>
</asp:datalist></td>
</tr>

Public Sub changePicture(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim item As DataListItem =
Picturelist.Items(Picturelist.EditItemIndex)
If (Not item Is Nothing) Then
Dim ddl As DataList = CType(item.FindControl("Picture"),
DataList)
Dim check As String = ddl.SelectedItem.DataItem

Dim IDCar As Integer = CInt(Request.Params("CarID"))
Dim Maintenance As MaintenanceDB = New MaintenanceDB

Dim myCarDetails As MaintenanceDetails =
Maintenance.GetACar(IDCar)

Pictureheader.ImageUrl = myCarDetails.CarPictureHeader
End If
End Sub

Jul 21 '05 #2
Thanks i got it

<td colSpan="2"><asp:datalist id="Picturelist"
OnItemCommand="Picturelist_ItemCommand" runat="server" RepeatColumns="8">
<itemtemplate>
<asp:ImageButton ID="Picture" height=100 width=100
CommandName="select" runat="server" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "carPicture") %>' />
</itemtemplate>
</asp:datalist></td>

Sub Picturelist_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
Picturelist.ItemCommand
If (e.CommandName = "select") Then
Dim Maintenance As MaintenanceDB = New MaintenanceDB
Dim IDCarPicture As Integer =
Picturelist.DataKeys(e.Item.ItemIndex)
Dim myPictureDetails As MaintenanceDetails =
Maintenance.GetACarpictureUrl(IDCarPicture)
Dim test As String = myPictureDetails.carPicturePathUrl
Pictureheader.ImageUrl = myPictureDetails.carPicturePathUrl
End If
End Sub
"Stanley J Mroczek" wrote:
When I click in a picture, I get a error the changePicture is undefined

<tr>
<td colSpan="2"><asp:datalist id="Picturelist" runat="server"
RepeatColumns="8">
<itemtemplate>
<img ID="Picture" height=100 width=100 onclick="changePicture"
runat="server" src='<%# DataBinder.Eval(Container.DataItem, "carPicture") %>'
/>
</itemtemplate>
</asp:datalist></td>
</tr>

Public Sub changePicture(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim item As DataListItem =
Picturelist.Items(Picturelist.EditItemIndex)
If (Not item Is Nothing) Then
Dim ddl As DataList = CType(item.FindControl("Picture"), DataList)
Dim check As String = ddl.SelectedItem.DataItem

Dim IDCar As Integer = CInt(Request.Params("CarID"))
Dim Maintenance As MaintenanceDB = New MaintenanceDB

Dim myCarDetails As MaintenanceDetails =
Maintenance.GetACar(IDCar)

Pictureheader.ImageUrl = myCarDetails.CarPictureHeader
End If
End Sub

Jul 21 '05 #3

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

Similar topics

3
17677
by: bob | last post by:
Hi, consider this script: <script> function doIt() { alert("ok") } document.onclick=doIt // or document.onclick=doIt() </script>
6
42194
by: waste | last post by:
hello. is it possible to clear onClick event? eg: <div ... onClick="someFunction()"> when I want to run someFunction() only once. -- waste
3
3238
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
4
2243
by: RobG | last post by:
I have a function whose parameter is a reference the element that called it: function someFunction(el) { ... } The function is assigned to the onclick event of some elements in the HTML...
3
2161
by: Glenn | last post by:
I've got a datalist that includes in each databound row a button to delete that specific record. But for some reason, clicking the button does not trigger the event handler. here's the datalist ...
2
327
by: Stanley J Mroczek | last post by:
When I click in a picture, I get a error the changePicture is undefined <tr> <td colSpan="2"><asp:datalist id="Picturelist" runat="server" RepeatColumns="8"> <itemtemplate> <img ...
2
2272
by: milbrand | last post by:
I have an ASPX page with a DataList. The ListItems contain a DropDownList and a Hyper Link. The user selects an Item from the Dropdown box and then selects the hyperlink to edit that item. My...
2
7697
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the...
6
2164
by: Nathan Sokalski | last post by:
I have a DataList which contains several LinkButtons, which are used to select a category in my application. I want the currently selected category to use a different CSS class. Here is an example...
0
7207
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
7095
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
7294
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
5602
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,...
1
5026
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...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
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
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.