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

Need to add aditional column to Datagrid

Hi,

I am new with VB.Net and I need some help

I am building an ASP.Net application in where the user enter a letter and
then press a button that make a SELECT in a SQL database. The results are
displayed in a Datagrid

This application is for look up phone numbers

I made the SELECT from three fields (LASTNAME, FIRSTNAME and NUMBER), I need
to add something like a hiperlink or a button in each row that make me
possible press it and look for the picture of the phone´s owner.

Is this possible ? Do you have an explample ?

Thanks in advance

I made this code:

Private Sub bBuscar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bBuscar.Click
Dim dReader2 As System.Data.SqlClient.SqlDataReader
Dim Comandosql As System.String
Comandosql = "Select LASTNAME,NAME,NUMBER from
EMPLOYEE "
SqlConnection1.Open()
SqlCommand1.Connection = SqlConnection1
If tApellido.Text <> "" Then Comandosql = Comandosql + "where
LASTNAME like '" + tApellido.Text + "%' "
If tApellido.Text <> "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + " and FILIAL = '" + dFilial.SelectedValue + "'"
If tApellido.Text = "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + "where FILIAL = '" +
dFilial.SelectedValue + "'"
End If
SqlCommand1.CommandText = Comandosql
Label2.Text = SqlCommand1.CommandText
dReader2 = SqlCommand1.ExecuteReader()
DataGrid1.DataSource = dReader2
DataGrid1.DataBind()
dReader2.Close()
SqlConnection1.Close()
Comandosql = ""
End Sub


Nov 20 '05 #1
1 973
http://www.c-sharpcorner.com/Code/20...LinkColumn.asp
"Javier Villegas" <jv*******@elsitio.net> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am new with VB.Net and I need some help

I am building an ASP.Net application in where the user enter a letter and
then press a button that make a SELECT in a SQL database. The results are
displayed in a Datagrid

This application is for look up phone numbers

I made the SELECT from three fields (LASTNAME, FIRSTNAME and NUMBER), I need to add something like a hiperlink or a button in each row that make me
possible press it and look for the picture of the phone´s owner.

Is this possible ? Do you have an explample ?

Thanks in advance

I made this code:

Private Sub bBuscar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bBuscar.Click
Dim dReader2 As System.Data.SqlClient.SqlDataReader
Dim Comandosql As System.String
Comandosql = "Select LASTNAME,NAME,NUMBER from
EMPLOYEE "
SqlConnection1.Open()
SqlCommand1.Connection = SqlConnection1
If tApellido.Text <> "" Then Comandosql = Comandosql + "where
LASTNAME like '" + tApellido.Text + "%' "
If tApellido.Text <> "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + " and FILIAL = '" + dFilial.SelectedValue + "'"
If tApellido.Text = "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + "where FILIAL = '" +
dFilial.SelectedValue + "'"
End If
SqlCommand1.CommandText = Comandosql
Label2.Text = SqlCommand1.CommandText
dReader2 = SqlCommand1.ExecuteReader()
DataGrid1.DataSource = dReader2
DataGrid1.DataBind()
dReader2.Close()
SqlConnection1.Close()
Comandosql = ""
End Sub


Nov 20 '05 #2

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

Similar topics

11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
3
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is...
1
by: William Gower | last post by:
I need to develop a datagrid that uses columns from a table. In addition I need two columns (checkboxes) that the user will use to indicate that this record can be closed later. The checkboxed...
1
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So...
10
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
10
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option....
0
by: Familjen Karlsson | last post by:
Hi I have downloaded some code and tried it and nothing happens with the datagrid. Explain what is wrong and what I have to do please. I have tried to Import the namespace Hamster and it didn't...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.