Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

GridView Cell width to width of TextBox...

$
0
0

I tried a few ways to set the width of the TextBox to the width of cell[1] of the GridView but I have not figured it out yet. Does anyone know how to get the width of the TextBox to match that of the width of cell[1] of the GridView?

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

namespace mrbeaches.Protected
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //TextBox1.Width = GridView1.SelectedRow.Cells[1].Width;
            TextBox1.Width = GridView1.Width;
            //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + GridView1.SelectedRow.Cells[1].Width + "');", true);
        }
    }
}




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>