Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 17th, 2012, 09:11 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Simple Question

If you have a details grid and you want to track information on sales leads, and customers and one of the data fields needs to be a text area, rather than a text box, what do you code in design view to make the input/display area a text area instead of a textbox?

Thanks Imar

PS How does setting this up as an Item Template differ from just the regular default field? Still a just a bit fuzzy on Item Templates.
Reply With Quote
  #2 (permalink)  
Old February 18th, 2012, 12:56 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there
in the source view, create a TemplateField:
HTML Code:
<asp:DetailsView ID="x" runat="server" AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="SqlDataSource1">
    <Fields>
        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />

       <%-- rest fields ... --%>

        <asp:TemplateField HeaderText="Special Field">
            <ItemTemplate>
                <asp:TextBox TextMode="MultiLine" Text='<%# Eval("SpecialField") %>' runat="server"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>

    </Fields>
</asp:DetailsView>
__________________
happy every time, happy every where

Reza Baiat

Last edited by irProject; February 18th, 2012 at 12:58 AM..
Reply With Quote
  #3 (permalink)  
Old February 18th, 2012, 09:40 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
PS How does setting this up as an Item Template differ from just the regular default field? Still a just a bit fuzzy on Item Templates.
Out of the box, a regular field generates controls appropriate for the type. E.g. a TextBox for a string property.

By converting it to a TemplateField (as shown by irProject) you let ASP.NET you want to define the content yourself. You can then set up whatever controls or other content you need, and use data binding to get data in and out of your control.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple question? Cade_Feng BOOK: Beginning Regular Expressions 3 October 18th, 2012 07:14 PM
not at all simple question petergoodman XSLT 0 July 18th, 2008 08:37 AM
simple question petergoodman XSLT 8 July 18th, 2008 07:57 AM
Very Simple Question YoungLuke C# 2 May 4th, 2007 02:23 AM
Simple question maximus101 Classic ASP Basics 2 October 18th, 2005 10:22 PM



All times are GMT -4. The time now is 11:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.