why my method didn't work ? did you tried it well ?
anyway , it is the suggested way to get primary keys from the datagrid.I
think you should try it again.
regards
"Ryan Riddell" <RyanRiddell@discussions.microsoft.com> wrote in message
news:7F1F30D9-8DFB-4C49-BEE9-87C41BEA6169@microsoft.com...[color=blue]
> Neither method worked for me.
>
> Instead I defined a style in the sheet.
> <head>
> <style type="text/css">
> .hidden
> {
> display: none;
> }
> </style>
> </head>
>
> Then I statically defined the columns and set the itemstyle and[/color]
headerstyle CssClass attribute to "hidden".[color=blue]
>
> <Columns>
> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"[/color]
CancelText="Cancel" EditText="Edit" />[color=blue]
> <asp:BoundColumn DataField="Product" HeaderText="Product" ReadOnly="true">
> <ItemStyle Font-Bold="True" />
> </asp:BoundColumn>
> <asp:BoundColumn DataField="Range" HeaderText="Range" />
> <asp:BoundColumn DataField="ProductId" Visible="true" ReadOnly="true">
> <HeaderStyle CssClass="Hidden" />
> <ItemStyle CssClass="hidden" />
> </asp:BoundColumn>
> <asp:BoundColumn DataField="CustomerId" Visible="true" ReadOnly="true">
> <HeaderStyle CssClass="Hidden" />
> <ItemStyle CssClass="hidden" />
> </asp:BoundColumn>
> </Columns>
>
>
> "Ryan Riddell" wrote:
>[color=green]
> > I am using the DataGrid control from 4guys[/color][/color]
(
http://aspnet.4guysfromrolla.com/dem...hlighter.aspx). I want to
display 2 columns and allow editing. The only column I want the user to be
able to change is the second column. I made this work via ReadOnly="true"
for the first column.[color=blue][color=green]
> >
> > The second requirement is that the grid stores 2 table primary key[/color][/color]
values in columns 3 and 4. These columns will mean nothing to the user and
could potentially confuse them. For this reason I need to hide the columns.
So in the DataGrid definition on the .aspx page I added:[color=blue][color=green]
> >
> > <asp:BoundColumn DataField="ProductId"[/color][/color]
Visible="false"></asp:BoundColumn>[color=blue][color=green]
> > <asp:BoundColumn DataField="CustomerId"[/color][/color]
Visible="false"></asp:BoundColumn>[color=blue][color=green]
> >
> > Then in the update command I simply Response.Write out the values for[/color][/color]
now:[color=blue][color=green]
> > Dim s1 As String = e.Item.Cells(1).Text
> > Dim s2 As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
> > Dim s3 As String = e.Item.Cells(3).Text
> > Response.Write(s1 + "__" + s2 + "::" + s3)
> >
> > Doing this yields:
> > [correctColumn1]__[correctColumn2]:: <-s3 is blank
> >
> > How do I get the values in the hidden third and fourth columns?
> >
> > Thanks,
> > Ryan[/color][/color]