Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

andyk1967

@andyk1967
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Dynamic control issue driving me nuts
    A andyk1967

    I can't take it any longer... Can someone pleaseeeee help me. I have included my code below. I have searched everything and read many articles but I still don't get it. So please no reaction in the sense; you must create your controls in page_load, you must recreate your controls in the onpageinit, preserve viewstate, etc. because I have seen all those matters, many many times. My guess is that I just miss a tiny bit... On a webform I have a placeholder and in codebehind this placeholder is filled with 2 dropdownlists and two buttons. The two lists are filled with data from a dbase. When a user clicks one button an item is transfered from one list to the other, vice versa. What happens in code below is that I have to click a button twice to have an item move. Actually the first time when I click the button the item is transfered but the list wont refresh, while I regenerate the listboxes in my on page init (i tried the on postback as well). When I do a response.redirect to the same page it works fine but that shouldn't be the way to go. Imports System.Data.SqlClient Imports System.Data Partial Class Beheer_viewstate Inherits System.Web.UI.Page Dim bID As Integer Sub Page_Init(ByVal s As Object, ByVal e As EventArgs) Handles MyBase.Init Session("boekingID") = 105 bID = 105 dynamiccontent() End Sub Sub dynamiccontent() Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("MyProvider")) conn.Open() 'ongeboekte extras per reiziger Dim get_boeker_ongeboekte_extras As New SqlCommand("get_boeker_ongeboekte_extras", conn) get_boeker_ongeboekte_extras.CommandType = CommandType.StoredProcedure get_boeker_ongeboekte_extras.Parameters.AddWithValue("@boekerID", bID) get_boeker_ongeboekte_extras.Parameters.AddWithValue("@boekingID", Session("boekingID")) Dim rdr_get_boeker_ongeboekte_extras As SqlDataReader = get_boeker_ongeboekte_extras.ExecuteReader() Dim extras As New ListBox extras.ID = "lbx_extras" & bID extras.DataSource = rdr_get_boeker_ongeboekte_extras extras.DataValueField = "extraID" extras.DataTextField = "naam" extras.EnableViewState = "true" extras.DataBind() rdr_get_boeker_ongeboekte_extras.Close() 'geboekte extras Dim get_boeker_geboekte_extras As New SqlCommand("get_boeker_geboekte_extras", conn) get_boeker_geboekte_extras.CommandType = CommandType.

    ASP.NET help design workspace

  • insert data from 10 textboxes
    A andyk1967

    That is a little bit too vague... I think it should be solved with the creation of a datatable somehow but dunno more than that. With only a loop I still have the problem that the textboxes have a name: textbox1, textbox2, etc.

    ASP.NET question database

  • First item in a DropDownList
    A andyk1967

    lstland.SelectedIndex = -1 after the databind should do the trick... or otherwise you could add an extra field on top before the drodown is generated f.e. "select an item"

    ASP.NET

  • insert data from 10 textboxes
    A andyk1967

    I have a simple question wich probably can be easily answered but I'm clueless. On a webform people can invite friends (lets say 10). So I have 10 times dropdown: Mr. / Mrs., 10 times: Tetxtbox; firstname and 10 times: Textbox emailadres. I want to insert these in tabel tblfriends. Before I insert I would like to do some validation to see if the friend allready exists in the database, sent an email to the person etc. But that is not the point really. Would I end up writing ten insert queries with lstmrmrs1, txtfirstname1, txtemal1 then lstmrmrs2, txtfirstname2, txtemal2, etc. up to 10 ? I have googled quite a bit but can't find a hint.

    ASP.NET question database

  • Pls Help... ASP.NET Upload File to Access Database Question
    A andyk1967

    Below is a sample for the upload of an image. It is not much different with word docs <%@ Import Namespace="System.io"%> <%@ Import Namespace="System.Drawing.Imaging"%> <%@ Import Namespace="System.Data.OleDb"%> <%@ Page Language="vb"%> Superfeet Private Sub Page_Load() 'Put user code to initialize the page here End Sub Sub doUpdate(s As Object, e As EventArgs) 'Making the Enter key call btnSearch_Click Page.RegisterHiddenField("__EVENTTARGET", "doUpdate") txtvolledige_tekst.Text = Server.HtmlEncode(txtvolledige_tekst.Text) Dim ConnStr As String Dim OleDb As String ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:\Inetpub\wwwroot\yourprojectfolder\yourdatabase.mdb;" OleDb = "Insert into sf_nieuwsartikel ( " OleDb += " titel " OleDb += " , volgorde " OleDb += " , volledige_tekst " OleDb += " , foto " OleDb += " ) values ( " OleDb += " @par_titel" OleDb += " , @par_volgorde " OleDb += " , @par_volledige_tekst" OleDb += " , @par_foto" OleDb += " )" Dim myOleDbconn As New OleDbConnection(ConnStr) Dim myOleDbcommand As New OleDbCommand(OleDb, myOleDbconn) myOleDbcommand.Connection.Open() Dim SourceFile As HttpPostedFile SourceFile = Request.Files(0) Dim br As BinaryReader = New BinaryReader(SourceFile.InputStream) Dim photo() As Byte = br.ReadBytes(SourceFile.InputStream.Length) br.Close() With myOleDbcommand.Parameters .Add(New OleDbParameter("@par_titel", OleDbType.VarChar)).Value = txttitel.Text.Trim .Add(New OleDbParameter("@par_volgorde", OleDbType.VarChar)).Value = txtvolgorde.Text.Trim .Add(New OleDbParameter("@par_volledige_tekst", OleDbType.VarChar)).Value = txtvolledige_tekst.Text.Trim .Add(New OleDbParameter("@par_foto", OleDbType.LongVarBinary, photo.Length)).Value = photo End With myOleDbcommand.ExecuteNonQuery() myOleDbcommand.Connection.Close() Response.Redirect("nieuwsartikel_tgv.html") End Sub

    ASP.NET csharp asp-net database help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups