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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Enter Text into Detailsview on Insert.

Enter Text into Detailsview on Insert.

Scheduled Pinned Locked Moved ASP.NET
databasedesign
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    japel
    wrote on last edited by
    #1

    Hi All I have a detailsview in Insert Mode and want to populate the myID field on insert with a new index number. What I am doing is checking the last index number and adding 1. Then I want to put this value in to the Detailsview myID field in read only so users can not change it. I want this to happen on the Detailsview_Inserting event. See code below.... Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DetailsView1.ItemInserted If DetailsView1.CurrentMode = FormViewMode.Insert Then LoadData() 'Get max entry in table myID field. 'Increment by one. 'Add to the myID field in the dateview. End If End Sub Private Sub LoadData() Dim oleConn As New OleDbConnection oleConn.ConnectionString = ConfigurationManager.ConnectionStrings("ShowRegDBConnectionString").ConnectionString Dim oleComm As New OleDb.OleDbCommand oleComm.Connection = oleConn Try oleConn.Open() oleComm.CommandText = ("SELECT Max(myID) FROM SuggestionTB") Dim myID As String = Convert.ToString(oleComm.ExecuteScalar()) oleConn.Close() LastValue = myID Catch ex As OleDbException oleConn.Close() End Try End Sub Any ideas....

    When people make you see red, be thankful your not colour blind.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

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