Datagrids Item Templetes not found by compiler

M

Michael Evanchik

Basically im using a mutltiline textbox in a datagrid since i cant get
text to wrap in a grid. If i refer to the textbox by id in any vb code
the compiler says the object does not exist. If instead i refer to the
value by the datagrid cell im getting a invalid class error from the
same code i have always used to get values from a cell. Here is the
code i am talking about....


This is my datagrid code
---------------------------------
<Columns>
<asp:EditCommandColumn EditText="" UpdateText=""/>
<asp:BoundColumn DataField="id" HeaderText="id" readonly="true" />
etc etc etc
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox id="txt_desc_g" Text='<%# DataBinder.Eval(Container,
"dataitem.job_description") %>' Columns="85" TextMode="MultiLine"
rows="18" Runat="server" visible="True" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>


If this is an a subroutine
--------------------------------
sub test
txt_desc_g.text = ""
end sub

The compiler tells me txt_desc_g.text doest not exist


In turn i use the code that works fine for non template columns...
-----------------------------

txtstr = e.item.cells(2).controls(0)
tempstr = txtstr.text


Im gettin an error invalid cast?
 

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

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top