hidden columns that contain a "key" field

Discussion in 'ASP .Net Datagrid Control' started by Boban Dragojlovic, Oct 10, 2003.

  1. I've seen several examples where people include a "key" column in the
    datagrid so that they know which row to update during the update phase.

    The examples I've seen look like this:

    <asp:BoundColumn Visible=True DataField="ID"
    HeaderText="ID"></asp:BoundColumn>

    When I do this in my own form, the column is not only not visible, but it is
    not sent to the browser.

    How can I get it to be sent, but remain hidden?
    Boban Dragojlovic, Oct 10, 2003
    #1
    1. Advertising

  2. You didnt include runtat attribute for boundcolumn, if didnt include that it
    wont get processed in server. Include that see, it should work.

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message
    news:k%yhb.13452$...
    >
    > I've seen several examples where people include a "key" column in the
    > datagrid so that they know which row to update during the update phase.
    >
    > The examples I've seen look like this:
    >
    > <asp:BoundColumn Visible=True DataField="ID"
    > HeaderText="ID"></asp:BoundColumn>
    >
    > When I do this in my own form, the column is not only not visible, but it

    is
    > not sent to the browser.
    >
    > How can I get it to be sent, but remain hidden?
    >
    >
    Saravana [MVP], Oct 12, 2003
    #2
    1. Advertising

  3. Boban Dragojlovic

    bspann Guest

    Boban,

    Like Saravana states, you must have the runat attribute set on the datagrid.
    Then under the <Columns> tag, include a
    <asp:BoundColumn Visible=False DataField="ID"></asp:BoundColumn>
    You must have a field in whatever you used to bind to the grid called "ID".
    If that field does not exist, you will either get an error or the field will
    not be included.

    If you are wanting to include the "ID" value appended to an URL that the
    user clicks, use the following code:
    <asp:TemplateColumn HeaderText="SomeText">
    <ItemTemplate>
    <a href=http://www.yoursite.com/application/page.aspx?id= <%#
    DataBinder.Eval(Container.DataItem, "ID") %> >Some Text</a>
    </ItemTemplate>
    </asp:TemplateColumn>

    That should get you started. Please post any questions.

    Thanks,

    Brian

    "Saravana [MVP]" <> wrote in message
    news:%...
    > You didnt include runtat attribute for boundcolumn, if didnt include that

    it
    > wont get processed in server. Include that see, it should work.
    >
    > --
    > Saravana
    > Microsoft MVP - ASP.NET
    > www.extremeexperts.com
    >
    >
    >
    > "Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message
    > news:k%yhb.13452$...
    > >
    > > I've seen several examples where people include a "key" column in the
    > > datagrid so that they know which row to update during the update phase.
    > >
    > > The examples I've seen look like this:
    > >
    > > <asp:BoundColumn Visible=True DataField="ID"
    > > HeaderText="ID"></asp:BoundColumn>
    > >
    > > When I do this in my own form, the column is not only not visible, but

    it
    > is
    > > not sent to the browser.
    > >
    > > How can I get it to be sent, but remain hidden?
    > >
    > >

    >
    >
    bspann, Oct 13, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick
    Replies:
    3
    Views:
    8,107
    Alexey Smirnov
    Apr 13, 2010
  2. GavMc
    Replies:
    4
    Views:
    316
    Evertjan.
    Sep 22, 2005
  3. Roger Pack
    Replies:
    3
    Views:
    149
    Roger Pack
    Sep 28, 2010
  4. Roy Adams

    writing from hidden field to text field

    Roy Adams, Dec 20, 2004, in forum: Javascript
    Replies:
    1
    Views:
    185
  5. Jason Carlton
    Replies:
    11
    Views:
    236
    Dr J R Stockton
    Dec 8, 2009
Loading...

Share This Page