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. Dropdownlist in gridview footer

Dropdownlist in gridview footer

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
11 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.
  • 4 4anusha4

    How to bind data to a gridview located in the footer row?

    P Offline
    P Offline
    padmanabhan N
    wrote on last edited by
    #2

    protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[0].Text = //your bind data } }

    Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

    1 Reply Last reply
    0
    • 4 4anusha4

      How to bind data to a gridview located in the footer row?

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

      protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList objDDL=new DropDownList(); objDDL.TextField="DisplayFieldName"; objDDL.ValueField="ValueFieldName"; objDDL.datasource="yourdatasoruce" ; objDDL.DataBind(); e.Row.Cells[0].Controls.Add(objDDL); } } Hope this helps!

      Coding C# www.excitetemplate.com

      4 1 Reply Last reply
      0
      • C Coding C

        protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList objDDL=new DropDownList(); objDDL.TextField="DisplayFieldName"; objDDL.ValueField="ValueFieldName"; objDDL.datasource="yourdatasoruce" ; objDDL.DataBind(); e.Row.Cells[0].Controls.Add(objDDL); } } Hope this helps!

        Coding C# www.excitetemplate.com

        4 Offline
        4 Offline
        4anusha4
        wrote on last edited by
        #4

        protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.

        C P 2 Replies Last reply
        0
        • 4 4anusha4

          protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.

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

          Which line is giving error? Check if "dvAssembly" is null, if so fill it first with data.

          Coding C# www.excitetemplate.com

          4 1 Reply Last reply
          0
          • 4 4anusha4

            protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.

            P Offline
            P Offline
            padmanabhan N
            wrote on last edited by
            #6

            4anusha4 wrote:

            DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly");

            is this the line where the error is generated....

            Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

            4 1 Reply Last reply
            0
            • C Coding C

              Which line is giving error? Check if "dvAssembly" is null, if so fill it first with data.

              Coding C# www.excitetemplate.com

              4 Offline
              4 Offline
              4anusha4
              wrote on last edited by
              #7

              there is error at the line where we find the dropdownlist

              C 1 Reply Last reply
              0
              • P padmanabhan N

                4anusha4 wrote:

                DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly");

                is this the line where the error is generated....

                Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

                4 Offline
                4 Offline
                4anusha4
                wrote on last edited by
                #8

                yes

                1 Reply Last reply
                0
                • 4 4anusha4

                  there is error at the line where we find the dropdownlist

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

                  DropDownList ddlAssembly = (DropDownList)e.Row.FindControl("ddlAssembly"); try this.

                  Coding C# www.excitetemplate.com

                  4 1 Reply Last reply
                  0
                  • C Coding C

                    DropDownList ddlAssembly = (DropDownList)e.Row.FindControl("ddlAssembly"); try this.

                    Coding C# www.excitetemplate.com

                    4 Offline
                    4 Offline
                    4anusha4
                    wrote on last edited by
                    #10

                    thank u yar its working

                    C 1 Reply Last reply
                    0
                    • 4 4anusha4

                      thank u yar its working

                      C Offline
                      C Offline
                      Coding C
                      wrote on last edited by
                      #11

                      Great :) My pleasure!!

                      Coding C# www.excitetemplate.com

                      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