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. How to use Edit and update in DataList???

How to use Edit and update in DataList???

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestionannouncement
10 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.
  • B Offline
    B Offline
    bijeshputhalath
    wrote on last edited by
    #1

    Hello, I have used a Datalist to display the records...i want to give provision for users to edit their record...How can l implement this by using datalist????If any idea Please help me..... Thanks in advance Bijesh

    M 1 Reply Last reply
    0
    • B bijeshputhalath

      Hello, I have used a Datalist to display the records...i want to give provision for users to edit their record...How can l implement this by using datalist????If any idea Please help me..... Thanks in advance Bijesh

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Sample ------ <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> || protected void dl_GalleryEdit(Object s, DataListCommandEventArgs e) { dlGallery.EditItemIndex = e.Item.ItemIndex; //Update Code bindData(); } Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

      B 1 Reply Last reply
      0
      • M Michael Sync

        Sample ------ <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> || protected void dl_GalleryEdit(Object s, DataListCommandEventArgs e) { dlGallery.EditItemIndex = e.Item.ItemIndex; //Update Code bindData(); } Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

        B Offline
        B Offline
        bijeshputhalath
        wrote on last edited by
        #3

        Hello.... Please help How we can regonize the specified item want to change by using this code dlGallery.EditItemIndex = e.Item.ItemIndex; our item template like this...... <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> How we can get the value of item?????? Please help to solve my problem thanks Biju

        M 1 Reply Last reply
        0
        • B bijeshputhalath

          Hello.... Please help How we can regonize the specified item want to change by using this code dlGallery.EditItemIndex = e.Item.ItemIndex; our item template like this...... <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> How we can get the value of item?????? Please help to solve my problem thanks Biju

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          What about EditTemplate? <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> || Check-out this example http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

          B 1 Reply Last reply
          0
          • M Michael Sync

            What about EditTemplate? <%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %> || Check-out this example http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

            B Offline
            B Offline
            bijeshputhalath
            wrote on last edited by
            #5

            Hello, I set the code like this in html...... ----------------------------------------------------------------------------- <%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>

            M 1 Reply Last reply
            0
            • B bijeshputhalath

              Hello, I set the code like this in html...... ----------------------------------------------------------------------------- <%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>

              M Offline
              M Offline
              Michael Sync
              wrote on last edited by
              #6

              bijeshputhalath wrote:

              string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;

              You should remove "AD_TITLE". string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;

              bijeshputhalath wrote:

              C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.

              Where do you set "marquee" in your code??

              Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

              B 1 Reply Last reply
              0
              • M Michael Sync

                bijeshputhalath wrote:

                string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;

                You should remove "AD_TITLE". string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;

                bijeshputhalath wrote:

                C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.

                Where do you set "marquee" in your code??

                Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

                B Offline
                B Offline
                bijeshputhalath
                wrote on last edited by
                #7

                Hello while i removing AD_TITLE and try with your suggestion....But the following error comes C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(151): 'System.EventArgs' does not contain a definition for 'AD_TITLE' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'FindControl' ----------------------------------------------------------------------------- Now My code is below --------------------------------- private void dlGallery_EditCommand(object sender, System.EventArgs e) { dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex; BindList(); } private void dlGallery_updateCommand(object sender, System.EventArgs e) { // string item = ((System.Web.UI.WebControls.Label)e.FindControl("Label1")).Text; // string qty = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text; string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text; str

                M 1 Reply Last reply
                0
                • B bijeshputhalath

                  Hello while i removing AD_TITLE and try with your suggestion....But the following error comes C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(151): 'System.EventArgs' does not contain a definition for 'AD_TITLE' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'FindControl' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'FindControl' ----------------------------------------------------------------------------- Now My code is below --------------------------------- private void dlGallery_EditCommand(object sender, System.EventArgs e) { dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex; BindList(); } private void dlGallery_updateCommand(object sender, System.EventArgs e) { // string item = ((System.Web.UI.WebControls.Label)e.FindControl("Label1")).Text; // string qty = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text; string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text; str

                  M Offline
                  M Offline
                  Michael Sync
                  wrote on last edited by
                  #8

                  Sorry.. my mistake .. Try again with the following code. e.Item.FindControl("") If it is not still working, I wanna know a few thing and will make a sample download for you. 1. Are you using VS 2003 or 2005? 2. Are those column in DataList the bounded column or unbounded?

                  Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

                  B 1 Reply Last reply
                  0
                  • M Michael Sync

                    Sorry.. my mistake .. Try again with the following code. e.Item.FindControl("") If it is not still working, I wanna know a few thing and will make a sample download for you. 1. Are you using VS 2003 or 2005? 2. Are those column in DataList the bounded column or unbounded?

                    Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

                    B Offline
                    B Offline
                    bijeshputhalath
                    wrote on last edited by
                    #9

                    Hello Thank you for your reply.... 1. Are you using VS 2003 or 2005? Ans: vs2003 2. Are those column in DataList the bounded column or unbounded? Ans:Bounded i try it with e.Item.FindControl("") But still the same error comes...... ------------------------------------------------------------------------- C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'Item' ---------------------------------------------------------------------------- Then i hide(//give comment lines and try if the Datalist showing the items or not **But the Error is like this ......What is my mistake, i cant recognize...???please help me to find it out.............** Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0122: 'Newclassified.Youradvts.dlGallery_cancelCommand(object, System.EventArgs)' is inaccessible due to its protection level Source Error: Line 7103: Line 7104: Line 7105:

                    M 1 Reply Last reply
                    0
                    • B bijeshputhalath

                      Hello Thank you for your reply.... 1. Are you using VS 2003 or 2005? Ans: vs2003 2. Are those column in DataList the bounded column or unbounded? Ans:Bounded i try it with e.Item.FindControl("") But still the same error comes...... ------------------------------------------------------------------------- C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'Item' C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'Item' ---------------------------------------------------------------------------- Then i hide(//give comment lines and try if the Datalist showing the items or not **But the Error is like this ......What is my mistake, i cant recognize...???please help me to find it out.............** Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0122: 'Newclassified.Youradvts.dlGallery_cancelCommand(object, System.EventArgs)' is inaccessible due to its protection level Source Error: Line 7103: Line 7104: Line 7105:

                      M Offline
                      M Offline
                      Michael Sync
                      wrote on last edited by
                      #10

                      bijeshputhalath wrote:

                      private void dlGallery_EditCommand(object sender, System.EventArgs e)

                      void dlGallery_EditCommand( Object sender, DataListCommandEventArgs e ) {

                      bijeshputhalath wrote:

                      private void dlGallery_updateCommand(object sender, System.EventArgs e)

                      private void dlGallery_updateCommand(object sender, DataListCommandEventArgs e)

                      bijeshputhalath wrote:

                      private void dlGallery_cancelCommand(object sender, System.EventArgs e)

                      private void dlGallery_cancelCommand(object sender, DataListCommandEventArgs e) If you want sample for that, please check the following link. http://www.dotnetjohn.com/articles.aspx?articleid=17 http://authors.aspalliance.com/aspxtreme/shared/viewsrc.aspx?path=/aspxtreme/sys/web/ui/webcontrols/demos/datalisteditcommand.aspx.src[^] x Hope it helps.

                      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

                      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