Foros del Web » Programación para mayores de 30 ;) » .NET »

Librerias en asp.net

Estas en el tema de Librerias en asp.net en el foro de .NET en Foros del Web. saludos...tengo un problema..como le hago para poner las sig librerias: Imports System.String Imports System.Data.SqlTypes Imports System.Data.Sql Imports System.Web Imports System.Data.SqlClient Imports System.Data el problema es ...
  #1 (permalink)  
Antiguo 21/09/2011, 15:24
 
Fecha de Ingreso: junio-2011
Mensajes: 329
Antigüedad: 12 años, 10 meses
Puntos: 2
Librerias en asp.net

saludos...tengo un problema..como le hago para poner las sig librerias:

Imports System.String
Imports System.Data.SqlTypes
Imports System.Data.Sql
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data

el problema es que pongo este codigo, el cual me hace q si pongo un boton a la hora de querer asignarle eventos me manda y me pone todo en el codigo html..y a la hora de querer asgnar un evento a un boton por ejemplo el sql command no me deja y las librerias no me deja ponerlas como normalmente seria..a alguien le ha pasado esto..?....yo le intente poniendo primero las librerias y luego copiar el codigo pero no quiere.....ojala y me pueden ayudar..saludos

<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

Sub ContactsGridView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)

' If multiple buttons are used in a GridView control, use the
' CommandName property to determine which button was clicked.
If e.CommandName = "Add" Then

' Convert the row index stored in the CommandArgument
' property to an Integer.
Dim index As Integer = Convert.ToInt32(e.CommandArgument)

' Retrieve the row that contains the button clicked
' by the user from the Rows collection.
Dim row As GridViewRow = ContactsGridView.Rows(index)

' Create a new ListItem object for the contact in the row.
Dim item As New ListItem()
item.Text = Server.HtmlDecode(row.Cells(2).Text) & " " & _
Server.HtmlDecode(row.Cells(3).Text)

' If the contact is not already in the ListBox, add the ListItem
' object to the Items collection of the ListBox control.
If Not ContactsListBox.Items.Contains(item) Then

ContactsListBox.Items.Add(item)

End If

End If

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>GridView RowCommand Example</title>
</head>
<body>
<form id="form1" runat="server">

<h3>GridView RowCommand Example</h3>

<table width="100%">
<tr>
<td style="width:50%">

<asp:gridview id="ContactsGridView"
datasourceid="SqlDataSource1"
allowpaging="True"
autogeneratecolumns="False"
onrowcommand="ContactsGridView_RowCommand"
runat="server">

<columns>
<asp:buttonfield buttontype="Link"
commandname="Add"
text="Add"/>
<asp:boundfield datafield="id"
headertext="id" SortExpression="id"/>
<asp:boundfield datafield="nombre"
headertext="nombre" SortExpression="nombre"/>
<asp:boundfield datafield="sid"
headertext="sid" SortExpression="sid"/>
</columns>

</asp:gridview>

</td>

<td style="vertical-align:top; width:50%">

Contacts: <br/>
<asp:listbox id="ContactsListBox"
runat="server" Height="200px" Width="200px"/>

</td>
</tr>
</table>

<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the AdventureWorks sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->


<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DatosConnectionString %>"
SelectCommand="SELECT [id], [nombre], [sid] FROM [usuarios]">
</asp:SqlDataSource>


</form>
</body>
</html>

Etiquetas: net, sql, vb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:38.