Object not set to an instance in asp.net
i have this code:
Dim txt = CType(GridView1.FindControl("cnt_content"), TextBox)
txt.Attributes.Add("style", "word-wrap:break-word;")
i'm always getting that txt is an object not set to an instance of an
object that's my asp code:
<asp:TemplateField HeaderText="Content">
<EditItemTemplate>
<asp:TextBox ID="cnt_content" runat="server"
Text='<%# Bind("cnt_content") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="cnt_content" runat="server" Text='<%#
Bind("cnt_content") %>'></asp:Label>
</ItemTemplate>
<ItemStyle wrap="true" Width="400px" />
</asp:TemplateField>
any help?
No comments:
Post a Comment