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 6712711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:17:31+00:00 2026-05-26T08:17:31+00:00

i want to fix a grdview column width in page load event. i bounded

  • 0

i want to fix a grdview column width in page load event.

i bounded this gridview from c# and also uses a datasource from c#

i want to set width for “Address” column ,because it has long data.i also want to use auto scroll to this gridview .

here is my code…

  protected void Page_Load(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(str);
    con.Open();
    DataSet ds = new DataSet();
    SqlCommand cmd = new SqlCommand("Select DISTINCT FName+ ' ' +MName+ ' ' +LName as Name,"
             + " HomePhone,MobileNo1,"
             + " UPPER(ResAddr1) ++'  '+ UPPER(Resaddr2) ++'  '+ UPPER(ResAddr3) ++'  '+ UPPER(Resaddr4) ++'  '+ UPPER(Resaddr5) ++'  '+ UPPER(Resaddr6) ++'  '+ Pincode ++'  '+City as Address,"
             + " g.Category,f.GroupName as 'Group',Seats,"
             + " dbo.CONCATWTOTSHOW(d.MemberId,d.GID,d.CID)As SeatNo,"
             + " AmountExpected,AmountReceived,Discount,AmountPending,b.Remarks as Reference, (d.MemberId)"
             + " from Person_Master a INNER JOIN Member_Master b ON a.PersonId=b.PersonId"
             + " LEFT JOIN Payment_Master c ON b.MemberId = c.MemberId"
             + " INNER JOIN SeatAssign_Master d ON b.MemberId = d.MemberId"
             + " INNER JOIN Year_Master e ON b.Year = e.Id"
             + " INNER JOIN Group_Master f ON d.Gid=f.Gid"
             + " INNER JOIN Category_Master g ON d.Cid=g.Cid "
             + " where b.Year=2 and g.Cid=2 and b.Active=1 and d.Active=1 ", con);
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    da.Fill(ds);

    GridView1.DataSource = ds;
    GridView1.DataBind();
}
  • 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-05-26T08:17:31+00:00Added an answer on May 26, 2026 at 8:17 am

    so do it in RowCreated event

     GridView1.RowCreated += new GridViewRowEventHandler(GridView1_RowCreated);
    
          void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
            {
                e.Row.Cells[0].Width = 200;
               // GridView1.Columns[0].HeaderStyle.Width = 100;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to fix a file in past commit. This might affect all ascending
Ok I want some opinions how I can fix this mess of a method!
I am ready to run this code but before I want to fix the
I want to fix a UISlider a constant distance away from the bottom of
This is my programs complete code, the only problem is i want to fix
In my web application i want to fix height and width of a PrimeFaces
%19 Left Section Width, %80 Content width: But i want to fix left section
I want to fix this problem with the z-index of a draggable div. I
I want fix problems with uppercase names on a MySQL column of with Hibernate
I want to fix an old C program (got the source) that uses relative

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.