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 make invisible comboBox visible in GridView

how to make invisible comboBox visible in GridView

Scheduled Pinned Locked Moved ASP.NET
databasetutorialannouncement
9 Posts 3 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.
  • A Offline
    A Offline
    AaronNeo
    wrote on last edited by
    #1

    Hi Everyone, I would like to know how am I able to access the templateField I created in my GridView, which I set it to invisible initially, to make it visible when user click on the EDIT button and subsequently update into the database for the selected value.

    S S 2 Replies Last reply
    0
    • A AaronNeo

      Hi Everyone, I would like to know how am I able to access the templateField I created in my GridView, which I set it to invisible initially, to make it visible when user click on the EDIT button and subsequently update into the database for the selected value.

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Try with Javascript for making the combo box as visible when the user clicks edit button in the Grid view.

      Regards, Satips.

      1 Reply Last reply
      0
      • A AaronNeo

        Hi Everyone, I would like to know how am I able to access the templateField I created in my GridView, which I set it to invisible initially, to make it visible when user click on the EDIT button and subsequently update into the database for the selected value.

        S Offline
        S Offline
        Sherin Iranimose
        wrote on last edited by
        #3

        Hi, When You create template field for edit, make it as "edit item template". No need to make invisible. An "edit item template" will automatically display when you press edit link.

        Sherin Iranimose

        A 1 Reply Last reply
        0
        • S Sherin Iranimose

          Hi, When You create template field for edit, make it as "edit item template". No need to make invisible. An "edit item template" will automatically display when you press edit link.

          Sherin Iranimose

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

          Thank you so much for your help. I am quite new to asp.net so i may be asking some silly questions. Can I ask you another question? When I enter editing mode, how do i set the value of the combobox to the record in my database. If the user changes it, how do get the value of the combobox and update it back to the database ?

          S 1 Reply Last reply
          0
          • A AaronNeo

            Thank you so much for your help. I am quite new to asp.net so i may be asking some silly questions. Can I ask you another question? When I enter editing mode, how do i set the value of the combobox to the record in my database. If the user changes it, how do get the value of the combobox and update it back to the database ?

            S Offline
            S Offline
            Sherin Iranimose
            wrote on last edited by
            #5

            hi, For make editing using gridview you should do following things. 1. Enable AutogenerateEditButton property of 'gridview' to true 2. Add Dropdownlist in to 'Item template' of 'gridview' /// <asp:DropDownList ID="DropDownList1" runat="server" Width="126px" DataSourceID="SqlDataSource1" DataTextField="Field2" DataValueField="Field1" SelectedValue='<%# Bind("Field1") %>'> </asp:DropDownList> /// 3. Add Dropdownlist in to 'Edit item template' of 'gridview' ///// <asp:DropDownList ID="DropDownList2" runat="server" Width="126px" DataSourceID="SqlDataSource1" DataTextField="Field2" DataValueField="Field1" SelectedValue='<%# Bind("Field1") %>'> </asp:DropDownList> ///// 4. Add an sqldatasource to your form //// <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=yourserver;Integrated Security=yes;Database=YourDatabase" SelectCommand="SELECT [field1], [field2] FROM [YourTable]"></asp:SqlDataSource > //// Now it will show the data in your table. 4. To update the data... You should specify an "UpdateCommand" to the sqldatasource of your "gridview". ex: UpdateCommand="UPDATE [YourTable] SET [field1]=@field1 WHERE [field2]=@field2" Try............... -- modified at 6:03 Wednesday 9th May, 2007

            Sherin Iranimose

            A 1 Reply Last reply
            0
            • S Sherin Iranimose

              hi, For make editing using gridview you should do following things. 1. Enable AutogenerateEditButton property of 'gridview' to true 2. Add Dropdownlist in to 'Item template' of 'gridview' /// <asp:DropDownList ID="DropDownList1" runat="server" Width="126px" DataSourceID="SqlDataSource1" DataTextField="Field2" DataValueField="Field1" SelectedValue='<%# Bind("Field1") %>'> </asp:DropDownList> /// 3. Add Dropdownlist in to 'Edit item template' of 'gridview' ///// <asp:DropDownList ID="DropDownList2" runat="server" Width="126px" DataSourceID="SqlDataSource1" DataTextField="Field2" DataValueField="Field1" SelectedValue='<%# Bind("Field1") %>'> </asp:DropDownList> ///// 4. Add an sqldatasource to your form //// <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=yourserver;Integrated Security=yes;Database=YourDatabase" SelectCommand="SELECT [field1], [field2] FROM [YourTable]"></asp:SqlDataSource > //// Now it will show the data in your table. 4. To update the data... You should specify an "UpdateCommand" to the sqldatasource of your "gridview". ex: UpdateCommand="UPDATE [YourTable] SET [field1]=@field1 WHERE [field2]=@field2" Try............... -- modified at 6:03 Wednesday 9th May, 2007

              Sherin Iranimose

              A Offline
              A Offline
              AaronNeo
              wrote on last edited by
              #6

              HI, Thank you so much for your wonderful reply. I still can't get it to work..The user changes the category from the category Combobox and I need it to update the selected category to the database. The rest of the fields in the editing mode are textboxes, so there are no problem with updating them. The bind command doesn't work as it says categoryName can't be found? Without the bind and inputing @categoryname doesn't reflect the selected comboxItem...I tried controlParameter under the updateParameter but it doesn't work as well...I am so lost....

              S 1 Reply Last reply
              0
              • A AaronNeo

                HI, Thank you so much for your wonderful reply. I still can't get it to work..The user changes the category from the category Combobox and I need it to update the selected category to the database. The rest of the fields in the editing mode are textboxes, so there are no problem with updating them. The bind command doesn't work as it says categoryName can't be found? Without the bind and inputing @categoryname doesn't reflect the selected comboxItem...I tried controlParameter under the updateParameter but it doesn't work as well...I am so lost....

                S Offline
                S Offline
                Sherin Iranimose
                wrote on last edited by
                #7

                Hi, In your select command of "sqldatasource" you should give that field name.

                Sherin Iranimose

                A 1 Reply Last reply
                0
                • S Sherin Iranimose

                  Hi, In your select command of "sqldatasource" you should give that field name.

                  Sherin Iranimose

                  A Offline
                  A Offline
                  AaronNeo
                  wrote on last edited by
                  #8

                  Thanks alot...i misses out the column name thats why i encounter the error..You are of a wonderful help, Sherin. May I ask you, how do i resize the textbox column in editing mode? I heard from my friends that it was fixed? How do I make it shorter in width? I got alot to learn from you...wonder if u have any email address or msn if you dun mind? :P anyway, Thank you so much for your help. I really appreciate it.. Regards, Aaron Neo

                  S 1 Reply Last reply
                  0
                  • A AaronNeo

                    Thanks alot...i misses out the column name thats why i encounter the error..You are of a wonderful help, Sherin. May I ask you, how do i resize the textbox column in editing mode? I heard from my friends that it was fixed? How do I make it shorter in width? I got alot to learn from you...wonder if u have any email address or msn if you dun mind? :P anyway, Thank you so much for your help. I really appreciate it.. Regards, Aaron Neo

                    S Offline
                    S Offline
                    Sherin Iranimose
                    wrote on last edited by
                    #9

                    hi AaronNeo, Do you know one thing.. The controls inside "Edit item template field" are same as other controls.So we can do whatever we like, on it. So just resize it in design mode itself(from inside the "Edit item template field"). try... vsherin@gmail.com

                    Sherin Iranimose

                    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