Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:37:59+00:00 2026-06-18T12:37:59+00:00

I am creating the grid view in code behind using TableCell and GridViewRow The

  • 0

I am creating the grid view in code behind using TableCell and GridViewRow

The data is fetched from the database table.

My code is :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class gv1 : System.Web.UI.Page
{
    SqlConnection cn;
    SqlCommand cmd;
    DataSet ds;
    SqlDataAdapter da;

   protected void Page_Load(object sender, EventArgs e)
  {
     cn = new SqlConnection("Data Source=AMIR-PC\\MOHEMMAD;Initial Catalog=CRM_InvestPlus;Integrated Security=True");

  }
  protected void Button1_Click(object sender, EventArgs e)
 {
    cn.Open();
    cmd = new SqlCommand("Select * from Customer_Master", cn);
    da = new SqlDataAdapter(cmd);
    ds = new DataSet();
    da.Fill(ds);
    cn.Close();

    GridView gr1 = new GridView();
    Table t = new Table();
    gr1.Controls.Add(t);

        for (int i = 0; i < 6; i++)
       {
           GridViewRow row = new GridViewRow(i, i, DataControlRowType.DataRow, DataControlRowState.Normal);
           TableCell cell1 = new TableCell();
           TableCell cell2 = new TableCell();
           TableCell cell3 = new TableCell();

           cell1.Text = ds.Tables[0].Rows[i][0].ToString();
           cell2.Text = ds.Tables[0].Rows[i][1].ToString();
           cell3.Text = ds.Tables[0].Rows[i][2].ToString();
           row.Cells.Add(cell1);
           row.Cells.Add(cell2);
           row.Cells.Add(cell3);

            gr1.Controls[0].Controls.AddAt(i, row);    

        }
        form1.Controls.Add(gr1);
    }
}

The Gridview is generated fine. But my problem is to display the FileUploadControl in the place of Cell3(i.e. I want to place the FileUploadControl in Cell3)

Please help..

Thanks in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:38:00+00:00Added an answer on June 18, 2026 at 12:38 pm

    Try this:

    FileUpload fileUpload = new FileUpload();
    cell3.Controls.Add(fileUpload);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a Attendance System and using grid view to insert the data.
I am creating table from code behind to show weekly report. It is working
I have a data table. After creating this table, I use data grid view
I am creating windows application to insert data from Excel file into database. My
I have a custom Grid view object that inherits from the base System.Web.UI.WebControls.GridView. The
I am creating a C# program where I can add data from the system
I'm creating a Django/JQuery/MySQL application where I pass a composite data structure 'grid' as
I have been following this nice walkthrough for creating a grid using MVC contrib.
I'm creating my own very basic Grid control. I've decided to derive from ScrollableControl
I am creating an app that that uses a tabbed view. I pull data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.