Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Need to add aditional column to Datagrid

Reply
Thread Tools

Need to add aditional column to Datagrid

 
 
Javier Villegas
Guest
Posts: n/a
 
      04-28-2004
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






 
Reply With Quote
 
 
 
 
William Ryan eMVP
Guest
Posts: n/a
 
      04-28-2004
http://www.c-sharpcorner.com/Code/20...LinkColumn.asp
"Javier Villegas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM
Cannot add a nested relation or an element column to a table containing a SimpleContent column. Random ASP .Net 1 11-19-2004 11:36 PM
Add column to the last column of Datagrid Hai Nguyen ASP .Net 0 01-16-2004 10:10 PM
how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ? Balaji ASP .Net Datagrid Control 0 07-07-2003 08:32 AM



Advertisments