's wild thoughts were released on 30 Apr
2006 11:14:01 -0700 bearing the following fruit:
>Hi everybody,
>
>I want to fill in a GridView with a dataset.
>So I created the list of fields that I want to see in the gridview.
>And I added a column (in first position in the gridview) as a
>ButtonField column (ButtonType: button).
>My records are loaded correctly.
>During the RowDataBound event, I tried to change the Text of the button
>for some records (depends of a check on others cells).
>
>if (e.Row.Cells[12].Text == var.ToString())
> e.Row.Cells[0].Text = "Cancel";
>else
> e.Row.Cells[0].Text = "Accept";
>
>When I keep this check (and set), the text is changed, perfect.
>But the type of my button is also changed.
>That become a link type (ButtonType: link) and no more a "button" type.
>
>Why ?
>I don't understand what's happening :-{
>
>If I don't perform my check (and set), the type of my ButtonField stays
>"button".
>
>Do you have a idea of what is wrong ?
You most likely need to change the text of the button not
the cell. I'm not sure how you'd achieve this if the button
is automatically generated but should be easy if you change
it to a template field.
Jan Hyde (VB MVP)
--
Women are like elephants to me. I like to look at them
but I wouldn't want to own one.
W.C. Fields