Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 October 21st, 2008, 08:13 AM
Authorized User
 
Join Date: Mar 2008
Location: Delhi
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to myself.panku
Default GridView binding with Arraylist

Hi Guys,

I have bound gridview with an ArrayList and now i want to display the content of arraylist inside the TextBox using Template Column.
Like.

        ArrayList objArrFname = new ArrayList();
        objArrFname.Add("File 1");
        objArrFname.Add("File 2");

        GridView1.DataSource = objArrFname;
        GridView1.DataBind();

        ---------------------------------------

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:TextBox ID="abcd" runat="server" Text=''></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

---------------------------------------------------

I could have done it using RowDataBound event of GridView. But i do not want to move on Code-Behind file for Solution.

I just wanna confirm that what should i write in Text property of TextBox
                  <asp:TextBox ID="abcd" runat="server" Text=''></asp:TextBox>

If we were using DataTable/DataSet then we can write
Text = '<%# Eval("ColumnName") %>'

Thanks & Regards

Pankaj Bahuguna

__________________
Thanks
-Pankaj Bahuguna
Reply With Quote
  #2 (permalink)  
Old November 5th, 2008, 03:19 AM
Registered User
 
Join Date: Oct 2008
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try like this for setting text

text = '<%# Container.DataItem %>'

Pankaj
www.dotnetspark.com
Reply With Quote
  #3 (permalink)  
Old November 5th, 2008, 05:52 AM
Authorized User
 
Join Date: Mar 2008
Location: Delhi
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to myself.panku
Default

Thanks MAN...

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
binding GridView at runtime! veda Visual Studio 2005 3 August 4th, 2008 06:44 AM
Binding GridView to ObjectDataSource which... rsearing ASP.NET 2.0 Professional 15 July 9th, 2008 01:44 AM
binding arraylist of structures to data grid in C# belzicool General .NET 1 May 9th, 2007 11:58 PM
Binding dropdownlist to gridView mcgarry101 ASP.NET 2.0 Basics 0 February 13th, 2007 07:12 AM
Binding fields on a gridview aldwinenriquez ASP.NET 2.0 Professional 0 June 1st, 2006 07:50 PM



All times are GMT -4. The time now is 06:01 PM.


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