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. Datagrid template

Datagrid template

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdatabaseoracle
7 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.
  • S Offline
    S Offline
    shereem khaleel
    wrote on last edited by
    #1

    hi i have a code in asp.net have the following problem ==> in the web page threr is a datagrid and have a datasource from oracle one of its column is a template and in the edit mode i convert it to dropdownlist control but i do not konw how to bind this drop down list with data from the database please HELP HELP HELP HELP ME ME ME ME :(( :confused:

    T 1 Reply Last reply
    0
    • S shereem khaleel

      hi i have a code in asp.net have the following problem ==> in the web page threr is a datagrid and have a datasource from oracle one of its column is a template and in the edit mode i convert it to dropdownlist control but i do not konw how to bind this drop down list with data from the database please HELP HELP HELP HELP ME ME ME ME :(( :confused:

      T Offline
      T Offline
      Tamimi Code
      wrote on last edited by
      #2

      what is the method you edit the grid with ??

      When you get mad...THINK twice that the only advice Tamimi - Code

      S 1 Reply Last reply
      0
      • T Tamimi Code

        what is the method you edit the grid with ??

        When you get mad...THINK twice that the only advice Tamimi - Code

        S Offline
        S Offline
        shereem khaleel
        wrote on last edited by
        #3

        unig bulid in function ==> Private Sub dg_find_result_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg_find_result.EditCommand

        T 1 Reply Last reply
        0
        • S shereem khaleel

          unig bulid in function ==> Private Sub dg_find_result_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg_find_result.EditCommand

          T Offline
          T Offline
          Tamimi Code
          wrote on last edited by
          #4

          so good.......... suppose that your column index is 2(i.e. the second column). then inside the dg_find_result_EditCommand, find your DropDownList, like this: Dim DDL As DropDownList = CType(grdItem.Cells(0).Controls(1), dropdownlist), then write the code to bind your DropDownList.

          When you get mad...THINK twice that the only advice Tamimi - Code

          S 1 Reply Last reply
          0
          • T Tamimi Code

            so good.......... suppose that your column index is 2(i.e. the second column). then inside the dg_find_result_EditCommand, find your DropDownList, like this: Dim DDL As DropDownList = CType(grdItem.Cells(0).Controls(1), dropdownlist), then write the code to bind your DropDownList.

            When you get mad...THINK twice that the only advice Tamimi - Code

            S Offline
            S Offline
            shereem khaleel
            wrote on last edited by
            #5

            when i write this code ==> Me.dg_find_result.EditItemIndex = e.Item.ItemIndex Dim DDL As DropDownList = CType(e.Item.FindControl("lst_temp_order_dir"), DropDownList) DDL.Items.Add("gggggg") Me.BindData() Catch ex As Exception Me.Literal1.Text = ex.Message End Try i get this error ==> Object reference not set to an instance of an object. ============================================================= and when i write this ==> Try Me.Literal1.Text = "" Me.dg_find_result.EditItemIndex = e.Item.ItemIndex Dim DDL As DropDownList = CType(e.Item.Controls(0), DropDownList) DDL.Items.Add("gggggg") Session("Edit_S") = e Me.BindData() Catch ex As Exception Me.Literal1.Text = ex.Message End Try i get this error ==> Specified cast is not valid =============================================== what is the problem and how i can solve it , please ?

            T 1 Reply Last reply
            0
            • S shereem khaleel

              when i write this code ==> Me.dg_find_result.EditItemIndex = e.Item.ItemIndex Dim DDL As DropDownList = CType(e.Item.FindControl("lst_temp_order_dir"), DropDownList) DDL.Items.Add("gggggg") Me.BindData() Catch ex As Exception Me.Literal1.Text = ex.Message End Try i get this error ==> Object reference not set to an instance of an object. ============================================================= and when i write this ==> Try Me.Literal1.Text = "" Me.dg_find_result.EditItemIndex = e.Item.ItemIndex Dim DDL As DropDownList = CType(e.Item.Controls(0), DropDownList) DDL.Items.Add("gggggg") Session("Edit_S") = e Me.BindData() Catch ex As Exception Me.Literal1.Text = ex.Message End Try i get this error ==> Specified cast is not valid =============================================== what is the problem and how i can solve it , please ?

              T Offline
              T Offline
              Tamimi Code
              wrote on last edited by
              #6

              try : Dim DDL As DropDownList = CType(e.Item.Controls(1), DropDownList)

              When you get mad...THINK twice that the only advice Tamimi - Code

              S 1 Reply Last reply
              0
              • T Tamimi Code

                try : Dim DDL As DropDownList = CType(e.Item.Controls(1), DropDownList)

                When you get mad...THINK twice that the only advice Tamimi - Code

                S Offline
                S Offline
                shereem khaleel
                wrote on last edited by
                #7

                it is also gove me this error ==> Specified cast is not valid in the datagrid the first column is the serial which is hidden and the second one i convert it to drop down list which i want to fill it with data .

                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