but is not possible call to matrix of checkbox easily, I don't want do it dinamically. why checkbox accept by code add property "group=" and later is not posible use it? I only want put visible or not visible "some" checkbox with a For next. I would like to have a easy sample about it. Thanks very much
Sandraa
Posts
-
how make a group checkbox vb.net (asp.net) -
how make a group checkbox vb.net (asp.net)Hi all, I have one question very very easy but what I don't know do. With vb 6 when I want create a group checkbox only I have that copy and paste the same checkbox into panel and vb 6 create the group. Well, with vb.net and asp.net (v.studio 2008) if I copy and paste the name ID is diferent and is not posible create a group with properties. Also I have tried select 2 or 3 checkbox with key "control + click" but nothing is not posible. Later I have tried to put into code the name of group and I don't see errors but I don't know how call later to group, I put you my simple code that I want to do:
<asp:Panel ID="Panel1" runat="server" Width="451px" > <asp:CheckBox ID="ChkDia1" runat="server" CssClass="negro11b" Text="Lunes" group="ChkDia" /> <asp:CheckBox ID="ChkDia2" runat="server" CssClass="negro11b" Text="Martes" group="ChkDia" /> <asp:CheckBox ID="ChkDia3" runat="server" CssClass="negro11b" Text="Miercoles" group="ChkDia"/> <asp:CheckBox ID="ChkDia4" runat="server" CssClass="negro11b" Text="Jueves" group="ChkDia"/> <asp:CheckBox ID="ChkDia5" runat="server" CssClass="negro11b" Text="Viernes" group="ChkDia"/> <asp:CheckBox ID="ChkDia6" runat="server" CssClass="negro11b" Text="Sabado" group="ChkDia"/> <asp:CheckBox ID="ChkDia7" runat="server" CssClass="negro11b" Text="Domingo" group="ChkDia"/> </asp:Panel> 'Ocultar todos chkDia Dim i As Integer For i = 1 To 7 ChkDia(i).Visible = False Next
Thanks for your help!
-
validate dropdownlist into DetailsViewHi all, I have a dropdownlist into a detailsview under vb.net (asp.net) and I want controller when user is in mode "insert" or "edit" this dropdownlist for enable or disable a textbox (into detailsview also) depending of value of dropdownlist. Without detailsview is easy, put dropdownlist in mode postback and I controller .value but with detailsview I don't know how controller it. Any idea? thanks very much.
-
Listbox sortI found the solve very easy :) You only call to this sub from button up Regards
Sub MoveSelectedItemUp(ByVal Box As ListBox) Dim Index As Integer = Box.SelectedIndex 'Index of selected item Dim Swap As Object = Box.SelectedItem 'Selected Item If Not (Swap Is Nothing) Then 'If something is selected... Box.Items.RemoveAt(Index) 'Remove it Box.Items.Insert(Index - 1, Swap) 'Add it back in one spot up 'Box.SelectedItem = Swap 'Keep this item selected End If End Sub
-
Listbox sortthe first thanks for your ideas, even I am thinking about it because I don't know like up or down items of my listbox with 2 button (up, down) and that user see it. The idea is can put order in listbox for later print a sheet of route for trucks, the first item will be the first customer for distribute and last item will be the last customer for distribute but doesn't exist a rule to order like asc or desc etc, it must be done by user like he wants. the idea after listbox is ordered is save this information to table for later print. Well, at the moment I will be happy to know like can up or down items of listbox with two buttons, later know like save it in array. I imagine that for sample if the item 7 of my listbox I push 3 times my button of "up" it will be my future item 4 but the problem is that my old item 4 now will be item 5 and my old item 6 will be item 7, haha I am losing myself :confused: Thanks for your ideas ;)
-
Listbox sortHello everybody, I don't know if it is posible do with a listbox or other object but i need to choose the order of a list of address for create later a route of trucks.(not sort by asc or desc) I want that a user can up o down a row of a listbox (or other object) for this election later save in a table. I am working with asp.net and vb.net I attach a picture for that you understand me better (my english is not good, sorry) Thanks for your help http://www.myleonberger.net/listbox.jpg
-
Export a sheet of excel to a table Sql-ServerHi all , again :) I continue with my problem of export excel to sql-server. I got export sheets of excel to a table of sql-server with this code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Path of file in machine of user
Label2.Text = System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName)
Dim connString As String = _
"Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = " & "'" & Label2.Text & "';" & _
"Extended Properties = 'Excel 8.0;HDR=Yes'"
Dim cnn As New OleDbConnection(connString)
Try
Dim sql As String = _
"INSERT INTO T_Recibos " & _
"IN ''[ODBC;DRIVER={SQL Server};" & _
"Server=Ip_Server;" & _
"Database=NameDatabase;" & _
"UID=User;" & _
"PWD=password]" & _
"SELECT Id_Comunidad, Id_finca FROM [Hoja1$]"
Dim cmd As New OleDbCommand(sql, cnn)
cnn.Open()
Dim n As Integer = cmd.ExecuteNonQuery()
Label1.Text = "Número de registros afectados: " & n.ToString
Catch ex As OleDbException
Label1.Text = (ex.Errors(0).Message)
Catch ex As Exception
Label1.Text = (ex.Message)
Finally
' Cerramos la conexión
cnn.Close()
cnn = Nothing
End Try
End Sub
End ClassNow my problem is the next, when I try it from my web(not IIS local) and from Sql-Server allocated in my server (not my local Sql-Server) I receive a error that say me that doesn't find the excel file. I understand why, the problem is that the path only work if the file excel is in the same server that SQL-Server. A solve will be upload the file excel and later make all but I want to know if is possible with asp.net make it directly from file excel allocate in local machine of user to Sql-Server allocated in a server far of user. Thanks again by all I am a little desespetare with this :confused:
-
Import sheet excel to table in Sql Server with Asp.net (VB)I found the error, the problem was that this part
"SELECT \* INTO T\_Recibos " & \_ "IN ''\[ODBC;DRIVER={SQL Server};" & \_ "Server=localmachine;" & \_ "Database=NAMEDATABASE;" & \_ "UID=Sandra;" & \_ "PWD=Sandra\]" & \_ "FROM \[Hoja1$\]"
create a new table T_Recibos but I had it created in Sql-server, I changed it by T_Recibos2 (what doesn't exist) and work! Now my problem is that I want to have a table (created into sql) and little to little that users add to it more rows from excel. any idea?
-
Import sheet excel to table in Sql Server with Asp.net (VB)somebody can help me? I have this code of a button the idea is export from excel to a table of sql-server but i received a OleDbException "ODBC: falló la llamada." that the translate is "ODBC: error failed the call" I put you my code:
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDbPartial Class Formularios_ImportarExcel
Inherits System.Web.UI.PageProtected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Button1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim connString As String = \_ "Provider = Microsoft.Jet.OLEDB.4.0;" & \_ "Data Source = C:\\test.xls;" & \_ "Extended Properties = 'Excel 8.0;HDR=Yes'" Dim cnn As New OleDbConnection(connString) Try Dim sql As String = \_ "SELECT \* INTO T\_Recibos " & \_ "IN ''\[ODBC;DRIVER={SQL Server};" & \_ "Server=localmachine;" & \_ "Database=NAMEDATABASE;" & \_ "UID=Sandra;" & \_ "PWD=Sandra\]" & \_ "FROM \[Hoja1$\]" Dim cmd As New OleDbCommand(sql, cnn) cnn.Open() Dim n As Integer = cmd.ExecuteNonQuery() Label1.Text = "Número de registros afectados: " & n.ToString Catch ex As OleDbException Label1.Text = (ex.Errors(0).Message) Catch ex As Exception Label1.Text = (ex.Message) Finally cnn.Close() cnn = Nothing End Try End Sub
-
Import sheet excel to table in Sql Server with Asp.net (VB)I am beginner, I accept all solutions :) The target is that from a web page a lot users can export data with a same template of excel in them hard disk to same table of sql-server. Later with all these data of table i will do web reports. Is not possible create a form for upload these data because these users has all data in excel and they want continue using excel. Thanks for help me.
-
Import sheet excel to table in Sql Server with Asp.net (VB)I want import data from excel to a table sql-server. Not binary object. And if is possible can use my present conection to sql server from web.config Thanks
-
Import sheet excel to table in Sql Server with Asp.net (VB)I believe that I explained bad, my problem is that I don't know import a sheet of excel to sql-server with my present connection. Regards
-
Import sheet excel to table in Sql Server with Asp.net (VB)Hi all, I need import from excel to a table Sql-Server with asp.net and i am using vb.net, i have seen some sample but even I don't understand how work and all samples is in c# and i need vb.net. I have my conexion to sql server in web.config
<appSettings> <add key="ConnectionString" value="Data Source=Mymachine;Initial Catalog=Database;Persist Security Info=False;user id=User;password=\*\*\*\*\*\*"/>
</appSettings>
for later I use a function for call it:
Public Shared Function ObtenerCadenaConexion() As String Return ConfigurationManager.AppSettings("ConnectionString") End Function
Someboy can help me? I need a sample easy for can import it from a web page Thanks very much
-
Session arraySolved I put into page_load
If Not Me.Page.IsPostBack Then Session("i") = 0 Dim Ar1(25, 1) As Integer Session("ArrayRespuestas") = Ar1 End If
Then only I define the array a time :) Thanks for your help ;-)
-
Session arrayDoesn't work because the postback empty my array when I push btton. I have when load the first ask (is a test of 25 ask):
Public Ar1(25, 1) As Integer
Procedure of load ask
Ar1(Session("i"), 0) = Session("Preguntas").Rows(Session("i"))("Id\_Pregunta") Session("ArrayRespuestas") = Ar1
later when button_onclick:
Dim respuesta As Integer
If RadioButton1.Checked = True Then respuesta = 1
If RadioButton2.Checked = True Then respuesta = 2
If RadioButton3.Checked = True Then respuesta = 3
If RadioButton4.Checked = True Then respuesta = 4
If RadioButton5.Checked = True Then respuesta = 5
Ar1(Session("i"), 1) = respuesta
Session("ArrayRespuestas") = Ar1
Session("i") = Session("i") + 1This work without errors, but when I try to recovery the datas of array I only get the value present Ar1(Session("i"), 1) but I lost the value Ar1(Session("i"), 0) because was added before of push button and later the postback empty my array. Good, realty is when I put Session("ArrayRespuestas") = Ar1 is when I clear my session array. I believe that the solve is to search like get not postback when click button. I accept advisers boys :)
-
Session arrayHi all, somebody knows how create a array multi-dimensional with session variables. I have it:
Session("Preguntas") = LPH.ObtenerTest(Session("Articulo"), Session("Nivel"))
where it session is a table and I want to add the result of client into other session array but with 2 columns, something similar to
Session("ArrayRespuestas")(Session("i"), 1) = "1"
. I use session variable because when the user make click into button I receive a postback and lost my original select (LPH.ObtenerTest(Session("Articulo"), Session("Nivel"))) that is a procedure that return a select random with 2 parameters. If I use
If Not Me.Page.IsPostBack Then
and put my select into later (the second page_load) doesn't load my select and when I call to
Preguntas.Rows(i)("Respuesta1")
I received a error where told me that I must first create a object. Thanks for all.
-
Onclick fire two eventsSolved :) I have changed this
e.Row.Cells(8).Attributes.Add("onclick", Me.ClientScript.GetPostBackEventReference(gridView, "Select$" + e.Row.RowIndex.ToString()))
by this
e.Row.Cells(8).Attributes.Add("onclick", "window.location='NuevoExpediente.aspx?Id=" + e.Row.Cells(6).Text + "&Nuevo=0" & "'")
because always fire the event gridView_SelectedIndexChanged, now all is more easy :) regards
-
Onclick fire two eventsHi all, I have a problem with event onclick i don't know why this event is fire 2 times when I make click in 2 place diferent. I put the little code for best sample:
Dim linkVer As LinkButton = CType(e.Row.Cells(0).Controls(2), LinkButton)
'This button go to a url
linkVer.Attributes.Add("onclick", "javascript:window.open(" + url + "," + parametros + ")")
'this is a link to other page in the same gridview but in other cell and is controlled by event gridView_SelectedIndexChanged
e.Row.Cells(8).Attributes.Add("onclick", Me.ClientScript.GetPostBackEventReference(gridView, "Select$" + e.Row.RowIndex.ToString()))The problem is that when I push the button linkver the program open url of linkver and url of e.row.cells(8) Some idea? thanks for all guys
-
DetailsView and dropdownlistS.O.S Even I continue with this problem, please any idea?
-
DetailsView and dropdownlistI believe that yes, I put you the code in aspx page
<asp:TemplateField HeaderText="Usuario del Servicio" > <ItemTemplate> <asp:Label ID="lblUsuario" Text='<%# Eval("Id\_Usuario") %>' runat="server"></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="EditComboUsuarios" runat="server"></asp:DropDownList> </EditItemTemplate> <InsertItemTemplate> <asp:DropDownList ID="InsertComboUsuarios" runat="server"></asp:DropDownList> </InsertItemTemplate> </asp:TemplateField>
I believe that I have put something bad in this code. Thanks for your help.