Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Datagrid Textbox (simple question)


Message #1 by soltisa@W... on Thu, 6 Feb 2003 09:53:13 -0800
When you hit edit in a datagrid and the textboxes for each field display,
how do you set the width for each textbox?

Alvin Soltis
PCS Center Technology
"The less you have, the less you have to worry about"

Message #2 by "Snead, George" <gqs4@c...> on Thu, 6 Feb 2003 14:18:30 -0500
Use an <asp:templatecolumn>
Then use an <itemtemplate> for display and an
<edititemtemplate> for the editing.

The <edititemtemplate> allows a width attribute.

<asp:templatecolumn headertext="User Id" 
	itemstyle-forecolor="#3300ff" itemstyle-font-bold="True">

	<itemtemplate><%# Container.DataItem( "userid" )%></itemtemplate>
	<edititemtemplate>
		<asp:textbox font-bold="True" forecolor="Red" id="txtRecId" 
		text='<%# Container.DataItem( "userid" )%>' runat="server"
width="45px" />
	</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn headertext="Last Name" itemstyle-forecolor="#3300ff" 
	itemstyle-font-bold="True">

	<itemtemplate><%# Container.DataItem( "last" )%></itemtemplate>
	<edititemtemplate>
		<asp:textbox font-bold="True" forecolor="Red" id="txtLast" 
		text='<%# Container.DataItem( "last" )%>' runat="server"
width="95px" />
	</edititemtemplate>
</asp:templatecolumn>

George E. Snead
george@s...

-----Original Message-----
From: soltisa@W... [mailto:soltisa@W...]
Sent: Thursday, February 06, 2003 12:53 PM
To: aspx_beginners
Subject: [aspx_beginners] Datagrid Textbox (simple question)


When you hit edit in a datagrid and the textboxes for each field display,
how do you set the width for each textbox?

Alvin Soltis
PCS Center Technology
"The less you have, the less you have to worry about"



  Return to Index