Data Grid - Update Columns

R

Ryan Ternier

I'm playing around with DataGrids and the Edit columns ability.

I have a text area that can be anywhere from 1-8000 characters.

When I add the edit capabilities to this DataGrid it displays a single line
TextBox.

Is there anyway of getting this textbox to be multi line, and only 450
characters wide?

I've gotten the width using CSS, but can't fingure out how to make it a
"textarea"

Thanks!

/RT
 
K

Ken Cox [Microsoft MVP]

Hi Ryan,

Are you using a template column? You should be able to configure a multiline
textbox inside that. You can said the character width using the Columns
attribute. Here's the idea:


<asp:templatecolumn>
<itemtemplate>
<asp:Label id="Label1" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.stringvalue") %>'>
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:TextBox id="TextBox1" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.stringvalue") %>'
TextMode="MultiLine" Height="55px" Columns="450">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>

Ken
Microsoft MVP [ASP.NET]
 
R

Ryan Ternier

Thanks Ken!

That worked very well... however, whenever i try to update that field, I
can't find the actual textbox that contains the new data.

in the Cell that contains the Description (what I need the multiline for),
there are 3 controls. 0 being literal, 1 textbox, 2 literal.

I've also tried:

txtDescription = e.Item.FindControl("txtDescription")

And that still yeields the original textbox without the modifications I
made.

Any suggestions?

Ken Cox said:
Hi Ryan,

Are you using a template column? You should be able to configure a multiline
textbox inside that. You can said the character width using the Columns
attribute. Here's the idea:


<asp:templatecolumn>
<itemtemplate>
<asp:Label id="Label1" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.stringvalue") %>'>
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:TextBox id="TextBox1" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.stringvalue") %>'
TextMode="MultiLine" Height="55px" Columns="450">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>

Ken
Microsoft MVP [ASP.NET]


Ryan Ternier said:
I'm playing around with DataGrids and the Edit columns ability.

I have a text area that can be anywhere from 1-8000 characters.

When I add the edit capabilities to this DataGrid it displays a single
line
TextBox.

Is there anyway of getting this textbox to be multi line, and only 450
characters wide?

I've gotten the width using CSS, but can't fingure out how to make it a
"textarea"

Thanks!

/RT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top