473,396 Members | 2,011 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,396 software developers and data experts.

I need a link on a datagrid

I need a link on a datagrid, the link must have fields of the database
Like this

acciones.aspx?iddireccion=1&idindicador=4

Thanks
Nov 18 '05 #1
5 1488
Search MSDN for info about the ASP:TemplateColumn

<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes' NavigateUrl='<%#
"contact_notes.aspx?id=" + DataBinder.Eval(Container, "DataItem.CLIENT_ID")
%>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>

"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
I need a link on a datagrid, the link must have fields of the database
Like this

acciones.aspx?iddireccion=1&idindicador=4

Thanks

Nov 18 '05 #2
It didnt work
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:Oz**************@TK2MSFTNGP10.phx.gbl...
Search MSDN for info about the ASP:TemplateColumn

<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes' NavigateUrl='<%#
"contact_notes.aspx?id=" + DataBinder.Eval(Container, "DataItem.CLIENT_ID") %>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>

"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
I need a link on a datagrid, the link must have fields of the database
Like this

acciones.aspx?iddireccion=1&idindicador=4

Thanks


Nov 18 '05 #3
Luis, you need to provide more details if you expect to get a detailed
response to your question.

What do you mean it didn't work? Why don't you post the HTML for your
DataGrid and let us take a look at it.
"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
It didnt work
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:Oz**************@TK2MSFTNGP10.phx.gbl...
Search MSDN for info about the ASP:TemplateColumn

<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes' NavigateUrl='<%# "contact_notes.aspx?id=" + DataBinder.Eval(Container,

"DataItem.CLIENT_ID")
%>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>

"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
I need a link on a datagrid, the link must have fields of the database
Like this

acciones.aspx?iddireccion=1&idindicador=4

Thanks



Nov 18 '05 #4
This is the code of the datagrid

<asp:datagrid id="dgmetas" runat="server" GridLines="Vertical"
CellPadding="3" BackColor="White"
BorderWidth="1px" BorderStyle="None" BorderColor="#999999"
AutoGenerateColumns="False" DataKeyField="idindicador"
Font-Size="X-Small" Font-Names="Trebuchet MS">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:TemplateColumn HeaderText="Nombre Indicador">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.nombreIndicador") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.nombreIndicador") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Ver"
CommandName="editarMetas" CausesValidation="false"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes'
NavigateUrl='<%acciones.aspx?iddireccion=" + DataBinder.Eval(Container,
"DataItem.iddireccion") + " &idindicador= " + DataBinder.Eval(Container,
"DataItem.idindicador")+"%>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
and this is teh code that fills the datagrid
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Introducir aquí el código de usuario para inicializar la página

SqlConnection1.Open()

If Not IsPostBack Then

Dim selectCMD As SqlCommand = New SqlCommand("select * from tbldirecciones",
SqlConnection1)

selectCMD.CommandTimeout = 30

Dim custDA As SqlDataAdapter = New SqlDataAdapter

custDA.SelectCommand = selectCMD

Dim custDS As DataSet = New DataSet

custDA.Fill(custDS, "tbldirecciones")

dgdir.DataSource = custDS.Tables("tbldirecciones").DefaultView

If custDS.Tables("tbldirecciones").Rows.Count = 0 Then

'errordir.Text = "NO hay direcciones en la base da datos, contacte al
Administrador"

Else

dgdir.DataBind()

End If

End If

End Sub
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:eK**************@TK2MSFTNGP12.phx.gbl...
Luis, you need to provide more details if you expect to get a detailed
response to your question.

What do you mean it didn't work? Why don't you post the HTML for your
DataGrid and let us take a look at it.
"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
It didnt work
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:Oz**************@TK2MSFTNGP10.phx.gbl...
Search MSDN for info about the ASP:TemplateColumn

<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes' NavigateUrl='<%# "contact_notes.aspx?id=" + DataBinder.Eval(Container,

"DataItem.CLIENT_ID")
%>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>

"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
> I need a link on a datagrid, the link must have fields of the database > Like this
>
> acciones.aspx?iddireccion=1&idindicador=4
>
> Thanks
>
>



Nov 18 '05 #5
DataBinder.Eval is C# specific. You're using VB.NET. Lookup the equivalent
in VB.NET

"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
This is the code of the datagrid

<asp:datagrid id="dgmetas" runat="server" GridLines="Vertical"
CellPadding="3" BackColor="White"
BorderWidth="1px" BorderStyle="None" BorderColor="#999999"
AutoGenerateColumns="False" DataKeyField="idindicador"
Font-Size="X-Small" Font-Names="Trebuchet MS">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:TemplateColumn HeaderText="Nombre Indicador">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.nombreIndicador") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.nombreIndicador") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Ver"
CommandName="editarMetas" CausesValidation="false"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:hyperlink runat="server" Text='Notes'
NavigateUrl='<%acciones.aspx?iddireccion=" + DataBinder.Eval(Container,
"DataItem.iddireccion") + " &idindicador= " + DataBinder.Eval(Container,
"DataItem.idindicador")+"%>'
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
and this is teh code that fills the datagrid
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Introducir aquí el código de usuario para inicializar la página

SqlConnection1.Open()

If Not IsPostBack Then

Dim selectCMD As SqlCommand = New SqlCommand("select * from tbldirecciones", SqlConnection1)

selectCMD.CommandTimeout = 30

Dim custDA As SqlDataAdapter = New SqlDataAdapter

custDA.SelectCommand = selectCMD

Dim custDS As DataSet = New DataSet

custDA.Fill(custDS, "tbldirecciones")

dgdir.DataSource = custDS.Tables("tbldirecciones").DefaultView

If custDS.Tables("tbldirecciones").Rows.Count = 0 Then

'errordir.Text = "NO hay direcciones en la base da datos, contacte al
Administrador"

Else

dgdir.DataBind()

End If

End If

End Sub
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:eK**************@TK2MSFTNGP12.phx.gbl...
Luis, you need to provide more details if you expect to get a detailed
response to your question.

What do you mean it didn't work? Why don't you post the HTML for your
DataGrid and let us take a look at it.
"Luis E Valencia" <lu*******@haceb.com> wrote in message
news:Ox*************@tk2msftngp13.phx.gbl...
It didnt work
"George Durzi" <gd****@hotmail.com> escribió en el mensaje
news:Oz**************@TK2MSFTNGP10.phx.gbl...
> Search MSDN for info about the ASP:TemplateColumn
>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:hyperlink runat="server" Text='Notes'

NavigateUrl='<%#
> "contact_notes.aspx?id=" + DataBinder.Eval(Container,
"DataItem.CLIENT_ID")
> %>'
> </asp:hyperlink>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> "Luis E Valencia" <lu*******@haceb.com> wrote in message
> news:eE*************@TK2MSFTNGP12.phx.gbl...
> > I need a link on a datagrid, the link must have fields of the database > > Like this
> >
> > acciones.aspx?iddireccion=1&idindicador=4
> >
> > Thanks
> >
> >
>
>



Nov 18 '05 #6

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

Similar topics

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...
3
by: Raymond Lewallen | last post by:
I have a modal dialog displaying a datagrid control. Click on the column header to sort the datagrid opens a new window with the following in the location: ...
2
by: Luis E Valencia | last post by:
I want a row of the datagrid with a personalized link. The fields of the link are on the select related to the datagrid the link would be accoiones.aspx?iddireccion=2&idindicador=5 I tried...
0
by: Luis E Valencia | last post by:
Read from above to top. I didnt understand. This is the code that fills that datagrid Public Sub pasar(ByVal sender As System.Object, ByVal e As...
2
by: JenHu | last post by:
hi, I have a datagrid in my asp.net application, I am using vb.net language. I want to have my last column as a link column, link to text file. The link path is "c:\Temp\" & F_File_Name, which...
2
by: Its_Me_SunnY | last post by:
Hi, can any one help me how to make a cell in data grid link to another page.... like i have a field "refno" in my table so when in get the values from table to datagrid the refno's of every...
4
by: Islamegy® | last post by:
In my EntityCollection inherted from CollectionBase I marked it and Implement ISerializable Interface.. here is the code.. GetObjectDate( .....)...
0
by: Terrance | last post by:
I'm working with ASP.NET 2.0 and I'm trying to figure out; how can I prevent the link that I have in a datagrid from showing up as a visited link? This is the code I have in the datagrid for the...
1
by: VanZandt | last post by:
I have a class(dll) that extends winform datagrid to provide link column in vb.net. I have managed to create a datagrid in c# winforms that shows link in one of the column but when I try to create a...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
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...
0
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,...

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.