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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. the DetailsView

the DetailsView

Scheduled Pinned Locked Moved ASP.NET
helpquestion
3 Posts 2 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.
  • D Offline
    D Offline
    Drathmar
    wrote on last edited by
    #1

    I'm using a details view for the first time. I have a data access layer in my program so I'd like to avoid using the SQLDataSource Object if I can. I've been trying to do an insert with the details view. On my details view I have OnItemInserting="DetailsViewSubmit_Insert" in my code section I have a function: protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e) From what I'm reading the information the user typed into the text boxes is supposed to be an an Idictionary object at "e.Values" However when I check e.Values.count its always empty. Has someone else come across this problem, or perhaps is there a better way to use the details view? Here's the full details view. protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e) { Response.Write("DetailsViewSubmit called - count = " + e.Values.Count); }

    M 1 Reply Last reply
    0
    • D Drathmar

      I'm using a details view for the first time. I have a data access layer in my program so I'd like to avoid using the SQLDataSource Object if I can. I've been trying to do an insert with the details view. On my details view I have OnItemInserting="DetailsViewSubmit_Insert" in my code section I have a function: protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e) From what I'm reading the information the user typed into the text boxes is supposed to be an an Idictionary object at "e.Values" However when I check e.Values.count its always empty. Has someone else come across this problem, or perhaps is there a better way to use the details view? Here's the full details view. protected void DetailsViewSubmit_Insert(Object sender, DetailsViewInsertEventArgs e) { Response.Write("DetailsViewSubmit called - count = " + e.Values.Count); }

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      The e.Values is only specified when you use the DetailsView control with a datasource control, here you have a data access layer you then may consider using the ObjectDataSource with the control. If you don't specify any datasource control in the DataSourceId property of the DetailsView, you'll need to manually get values from the control and do the insert command. You can read more about how to use the ObjectDataSource and DetailsView control in MSDN.

      D 1 Reply Last reply
      0
      • M minhpc_bk

        The e.Values is only specified when you use the DetailsView control with a datasource control, here you have a data access layer you then may consider using the ObjectDataSource with the control. If you don't specify any datasource control in the DataSourceId property of the DetailsView, you'll need to manually get values from the control and do the insert command. You can read more about how to use the ObjectDataSource and DetailsView control in MSDN.

        D Offline
        D Offline
        Drathmar
        wrote on last edited by
        #3

        thank you for your previous help from before I've been using a detailsview, an object data sources, with a data access layer, and a stored procedure, and my back to a problem with E.values. What i'm trying to do is, after I insert a new event, I want to get the the key of the newly inserted event and set that key as my current key for the details view. I've been playing with the parameter output, I know that i'm setting EventsKey to the newly added record. I tried to catch it in "OnItemInserted" but when I output all the values from e.values, the new key isn't part of that list. I don't know where the output parameter would be stored, or if there's a better way to get this new key value back to the business layer. Drathmar Here's my code: **Object Data source** **data access layer function** public static Boolean EventsAdd(string UserKey, string EventTitle, string EventDescription, DateTime EventDate, out string Eventkey) { SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand("EventsAdd", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@UserKey", SqlDbType.Int, 4)); cmd.Parameters["@UserKey"].Value = UserKey; cmd.Parameters.Add(new SqlParameter("@EventTitle", SqlDbType.VarChar, 20)); cmd.Parameters["@EventTitle"].Value = EventTitle; cmd.Parameters.Add(new SqlParameter("@EventDescription", SqlDbType

        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