By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,534 Members | 1,807 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,534 IT Pros & Developers. It's quick & easy.

I need a link on a datagrid

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.