473,782 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Err when creating link to each line of grid ..?

Hi,
I am having err when creating link to each line of grid at LINE 38. My
objective in asp.net is: each line can be linked to page with your
parameters as VB 5/6, Delphi 5/6/7, etc....
See the code bellow:
Thanks!
---------------------------------------
Vilmar Brazão de Oliveira
HI-TEC Informática

<%@ Page Language="vb" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<script language="VB" runat="server">
Sub Page_Load(sende r as Object, e as EventArgs)
Dim connString as String 'Create a connection string
connString = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;DATA SOURCE=" &
Server.MapPath( "Northwind.mdb" )
'C:\Arquivos de programas\Micro soft Office\Office\S amples\Northwin d.mdb

'Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection (connString)
objConnection.O pen()

'Specify the SQL string
Dim strSQL as String = "SELECT * FROM Clientes"

'Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(st rSQL, objConnection)

'Get a datareader
Dim objDataReader as OleDbDataReader
objDataReader = objCommand.Exec uteReader(Comma ndBehavior.Clos eConnection)

'Do the DataBinding
dgResults.DataS ource = objDataReader
dgResults.DataB ind()

'Close the datareader/db connection
objDataReader.C lose()

'Montagem de link.
Dim I as Double
Dim Registro as String

For I = 0 To Me.dgResults.It ems.Count - 1
Dim NomeLink As LinkButton =
CType(datagrid. Items(i).FindCo ntrol("NomeLink "), LinkButton) 'LINE 38
Registro = Tabela.Rows(I)
lnkEdita.Comman dArgument = "Param=" & valor
Next
End Sub

Sub myItems_ItemDat aBound(ByVal Sender As Object, ByVal e As
DataGridItemEve ntArgs)
dgResults.Attri butes.Add("onCl ick","JavaScrip t:alert('texto' );")

If e.Item.ItemType = ListItemType.It em Then
e.Item.Attribut es.Add("onmouse over",
"this.style.bac kgroundColor='# EEEEEE'")
e.Item.Attribut es.Add("onmouse out",
"this.style.bac kgroundColor='# F7EFC6'")
ElseIf e.Item.ItemType = ListItemType.Al ternatingItem Then
e.Item.Attribut es.Add("onmouse over",
"this.style.bac kgroundColor='# EEEEEE'")
e.Item.Attribut es.Add("onmouse out",
"this.style.bac kgroundColor='# F7EFC6'")
End If
End Sub

Protected Sub EventoNoClick(B yVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs)
Response.Redire ct("SeuAspx.asp x?" & e.CommandArgume nt)
End Sub

'FFFFEF »»um tom de amarelo bem claro.
'F7EFC6 »»um tom de amarelo meio ocre.
</script>

<html>

<head>
<title>Exempl o consulta com ASP.Net - 02</title>
</head>

<body text="#000000" bgcolor="#fffff f">
<h1>Exemplo consulta com ASP.Net - 01</h1>

<asp:DataGrid
id="dgResults" runat="server" Width="700" BackColor="#F7E FC6"
BorderColor="bl ack"
ShowFooter="fal se" CellPadding="3" CellSpacing="0" Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#ffa ad" OnItemDataBound ="myItems_ItemD ataBound">
</asp:DataGrid>

<asp:TemplateCo lumn HeaderText="Ass unto">
<ItemStyle width="33%"></ItemStyle>
<ItemTemplate >
<asp:LinkButt on id="NomeLink" runat="server" OnCommand="Even toNoClick"
Font-Size="9pt"
Text='<%# DataBinder.Eval (DataSet, "Tables[Tabela].DefaultView.[0].Campo")
%>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateCol umn>

</body>
</html>
Nov 18 '05 #1
0 1245

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

Similar topics

8
7933
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the same control. Is there anyone who has tried this before and knows why this is hapenning ??
2
2016
by: Sherwood Botsford | last post by:
I'm new to access. I have an orienteering database that has information about locations all over the map. Each location has 0-N clues I've worked up a report that will print the locations, with their associated information, and the clues that go with that.
1
1770
by: krian | last post by:
Hi, I need a help from anybody. My problem is here I wrote two WebApplication in ASP.net Using C#. The name of the applications are (Journal.aspx and Payment.aspx). These Two pages have DataGrids in each page and links to the other page(Journal.aspx contain Payment.aspx link and Payment.aspx contain Journal.aspx link) Suppose we added (updated) data in the DataGrid which is in "Journal.aspx" page and clicked the link which in the page....
7
2084
by: who be dat? | last post by:
I need some help here. I'm creating a list on a page where the list is created from a dataset with two tables linked with a datarelation. The first table is a list of groups while the second table is a list of items in that group. I want to show these items in what would basically look a lot like a tree view. I decided to just show everything in a placeholder control on an aspx form. First, I display a groupname from the first table...
5
3700
by: Richard Bysouth | last post by:
Hi I am trying to create an object that I can use to bind to a grid in my Win app. All of the examples that I have found on custom data sources have the properties (e.g. FirstNamer, LastName) of the objects making up the columns in a grid. In my situation however there can be any number of columns. I have created Row and Column classes, each of which have properties such as Visible. Columns have a Caption property which should become...
4
5006
by: Bit byte | last post by:
I have a project that I normally build (without problems) from the DevStudio IDE. However, I have embarked on automating all my builds (this test project being one of several). The project creates a DLL. I am able to build the project without any probs in the IDE, however - when I build the project from the command line (using the same options shown in the 'Command line' node in the 'Project Settings' dialog box), I get the following...
3
7635
by: kaczmar2 | last post by:
Hey there, I have a large image in a browser window, and I would like a way to overlay grid lines on top of the image, so a user can show the grid or hide the grid lines. The grid would cover 100% of the image, and all I would need is a set of horizontal and vertical lines over the image to create a grid overlay. Two requirements would be to:
1
2091
by: --== Alain ==-- | last post by:
Hi, I finally found how to update the render of my custom control when one of its property value changed. However, i would like to know if there is not another way, because i'm afraid about memory usage or leak. The following code is only a change color property update, but it is easy to adapt it to other properties.
1
2066
by: djcronos | last post by:
Hi all, I'm using an open source template from oswd.org and I wanted to change the color of one of the links to make it stand out from the others. Here's the CSS code: .nav3-grid {width:199px; border-bottom:solid 1px rgb(200,200,200);} .nav3-grid dt a, .nav3-grid dt a:visited {display:block; min-height:2.0em /*Non-IE6*/; height:auto !important; height:2.0em /*IE6*/; line-height:2.0em; padding:0px 10px 0px 20px; border-top: solid 1px...
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7492
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.