Reputation: 37460
I have a gridview that sets the AutoGenerateEditButton="true"
How can I set the width of the resulting column?
Upvotes: 3
Views: 6419
Reputation: 951
12+ years later, we can do this with CSS:
td:first-child
{
width: 5%;
}
Upvotes: 0
Reputation: 2528
I believe that you don't have direct control over the column containing the edit button - because of the "AutoGenerate" in the property you are setting, it is rendered automatically.
An alternative is to set AutoGenerateEditButton="False"
, and define a column containing the Edit command button yourself. Then in the markup, you can set the width of that column yourself.
Upvotes: 2
Reputation: 5550
I don't know if you can set the width when the Edit button is auto-generated.
But you can set it if you add the CommandField.
Steps:
The Command buttons (edit, cancel, update) will still behave as if you had auto-generated them, you just get more control over the layout.
Upvotes: 7