GRidview Add TEmplate columns programically with textboxes on the fly with a dataset vb

Posted on 2006-05-11
Last Modified: 2012-05-05
I can make the template fields the way I want hard coded  Example below.

<asp:BoundField DataField="SPH" HeaderText=" Sphere" ReadOnly="True" SortExpression="SPH" />
                <asp:TemplateField HeaderText="0" SortExpression="c0">
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("c0") %>'></asp:TextBox>
                        <asp:TextBox ID="TextBox1" runat="server" Width="40px" Text='<%# Bind("c0") %>'></asp:TextBox>
                <asp:TemplateField HeaderText="-.25" SortExpression="c25">
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("c25") %>'></asp:TextBox>
                        <asp:TextBox ID="TextBox2" runat="server" Width="40px" Text='<%# Bind("c0") %>'></asp:TextBox>

But the problem is I need to do this on the fly with columns from my dataset as the number of colums change by the range of the product chosen.
Sometimes I have 7 colums other 15. The number of rows change to but that is not a problem.
Any help would be greatly appreciated.

Question by:astafate
    1 Comment
    LVL 25

    Accepted Solution

    Dynamically loading an IBindableTemplate


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now