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 edit problem

Datagrid edit problem

Scheduled Pinned Locked Moved ASP.NET
helpdesignquestion
16 Posts 4 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.
  • C Offline
    C Offline
    Commickey
    wrote on last edited by
    #1

    Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

    A A V 6 Replies Last reply
    0
    • C Commickey

      Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

      A Offline
      A Offline
      amaneet
      wrote on last edited by
      #2

      In editItemTemplate there is linkbutton or textbox.If there is a linkbutton then change it to textbox.

      C 1 Reply Last reply
      0
      • A amaneet

        In editItemTemplate there is linkbutton or textbox.If there is a linkbutton then change it to textbox.

        C Offline
        C Offline
        Commickey
        wrote on last edited by
        #3

        Hello, the only option in the edititemtemplate is a linkbutton or push button... so how do I change this to a textbox? Thanks alot, Commickey

        A 1 Reply Last reply
        0
        • C Commickey

          Hello, the only option in the edititemtemplate is a linkbutton or push button... so how do I change this to a textbox? Thanks alot, Commickey

          A Offline
          A Offline
          amaneet
          wrote on last edited by
          #4

          linkbutton or push button is your project options or you are saying only two two controls are available in the edititemtemplate.If your case is latter one then you can check it again , there is checkbox, button, image,label,textbox controls etc available in the edititemtemplate.You can use any of them

          C 1 Reply Last reply
          0
          • A amaneet

            linkbutton or push button is your project options or you are saying only two two controls are available in the edititemtemplate.If your case is latter one then you can check it again , there is checkbox, button, image,label,textbox controls etc available in the edititemtemplate.You can use any of them

            C Offline
            C Offline
            Commickey
            wrote on last edited by
            #5

            hello, thanks alot, I am using Visual studio 2003 and it has only two controls in the edititemtemplate which are link button and push button... So how u I change this to a textbox?

            C 1 Reply Last reply
            0
            • C Commickey

              hello, thanks alot, I am using Visual studio 2003 and it has only two controls in the edititemtemplate which are link button and push button... So how u I change this to a textbox?

              C Offline
              C Offline
              Commickey
              wrote on last edited by
              #6

              How do I reach the edititemtemplate in visual studio 2003?

              V 1 Reply Last reply
              0
              • C Commickey

                Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

                A Offline
                A Offline
                Abhijeet_priyn
                wrote on last edited by
                #7

                Hi Try this one.... textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[0].Controls[0]; or textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[0].Controls[1]; Abhijeet

                C 1 Reply Last reply
                0
                • C Commickey

                  How do I reach the edititemtemplate in visual studio 2003?

                  V Offline
                  V Offline
                  varshavmane
                  wrote on last edited by
                  #8

                  Just go in HTML and in that put textbox inside.For ex: I hope this will help u.

                  C 1 Reply Last reply
                  0
                  • A Abhijeet_priyn

                    Hi Try this one.... textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[0].Controls[0]; or textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[0].Controls[1]; Abhijeet

                    C Offline
                    C Offline
                    Commickey
                    wrote on last edited by
                    #9

                    Hello, I tried ur suggestion but am still gettin the same error message.... Any further help?

                    1 Reply Last reply
                    0
                    • V varshavmane

                      Just go in HTML and in that put textbox inside.For ex: I hope this will help u.

                      C Offline
                      C Offline
                      Commickey
                      wrote on last edited by
                      #10

                      Hello, I couldn'see ur example.... can u please repost it? Thanks in advance, commickey

                      V 2 Replies Last reply
                      0
                      • C Commickey

                        Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

                        V Offline
                        V Offline
                        varshavmane
                        wrote on last edited by
                        #11

                        Just go in HTML and in that put textbox inside.For ex: I hope this will help u.

                        1 Reply Last reply
                        0
                        • C Commickey

                          Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

                          V Offline
                          V Offline
                          varshavmane
                          wrote on last edited by
                          #12

                          Just go in HTML and in that put textbox inside.For ex: asp:TemplateColumn I hope this will help u.

                          1 Reply Last reply
                          0
                          • C Commickey

                            Hello, I couldn'see ur example.... can u please repost it? Thanks in advance, commickey

                            V Offline
                            V Offline
                            varshavmane
                            wrote on last edited by
                            #13

                            hi I am trying that but its not working.U just need to go to the HTML code and add Inside this u will see and inside this u will find I hope now u can c and also u got help from me. Thanks and Regards.

                            1 Reply Last reply
                            0
                            • C Commickey

                              Hello, I couldn'see ur example.... can u please repost it? Thanks in advance, commickey

                              V Offline
                              V Offline
                              varshavmane
                              wrote on last edited by
                              #14

                              hi I am trying that but its not working.U just need to go to the HTML code and add

                              Commickey wrote:

                              Inside this u will see

                              Commickey wrote:

                              and inside this u will find

                              Commickey wrote:

                              I hope now u can c and also u got help from me. Thanks and Regards.

                              1 Reply Last reply
                              0
                              • C Commickey

                                Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

                                V Offline
                                V Offline
                                varshavmane
                                wrote on last edited by
                                #15

                                Just use TemplateColumn u will find edititemtemplate.

                                1 Reply Last reply
                                0
                                • C Commickey

                                  Hello, I have this code System.Web.UI.WebControls.TextBox textpersid = new System.Web.UI.WebControls.TextBox(); textpersid = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0]; and I always get the error: Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton' to type 'System.Web.UI.WebControls.TextBox'. Can someone help me on this? Thanks alot, Commickey

                                  A Offline
                                  A Offline
                                  amaneet
                                  wrote on last edited by
                                  #16

                                  <datagrid> <columns> <asp:templatecolumn> <itemtemplate> <asp:label id = "label" runat = server"></asp:label> </itemtemplate> <edititemtemplate> <asp:textbox id = "textbox" runat = server></asp:textbox> <edititemtemplate> </asp:templatecolumn> </columns> </datagrid> -- modified at 6:26 Monday 12th June, 2006

                                  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