I have the default "Enable Editing" check on the GV.
When a user clicks on the "Edit" for a row, I need to have one of the
columns set to a value which is stored in a QueryString.
After the "Edit" button is clicked I can set the TextBox value as desired,
however, after clicking "Update" the changes are not posted to either the GV
nor the database.
Here is what I have currently.
<asp:TemplateField HeaderText="modifiedby" SortExpression="modifiedby">
<EditItemTemplate>
<asp:TextBox ID="tbEditItemModifiedBy" runat="server" ReadOnly="false"
Text='<%# Request.QueryString("userid").ToString()%>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="tbItemModifiedBy" runat="server" Text='<%# Bind("modifiedby")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
I am able to "Edit" other values and are saved accordingly. I am having the
problem whey I try to dynamically update values on the fly.
TIA,
Steve
> I have the default "Enable Editing" check on the GV.
>
[quoted text clipped - 24 lines]
>
> Steve
The key to why it doesn't work is that the "modifiedby" column of the
database is not bound to the EditItemTemplate. Note that the
ItemTemplate has the 'Bind' method in the Text property of the label.
In order for the contents of the Textbox in the EditItemTemplate to be
bound similarly, the same expression is required.
As it is, Update will not change the database "modifiedby" column
value.
In order for your Update method to work you will have apply the change
programatically during the "RowUpdating" event using a statement
something like this:
e.NewValues("modifiedby") = Request.QueryString("userid")
HTW
Steve Wofford - 29 Mar 2008 03:48 GMT
Didnt have to change a thing, just had to copy/paste.
Steve
On 28 Mar, 03:29, "Steve Wofford" <intrar...@yahoo.com> wrote:
> I have the default "Enable Editing" check on the GV.
>
[quoted text clipped - 27 lines]
>
> Steve
The key to why it doesn't work is that the "modifiedby" column of the
database is not bound to the EditItemTemplate. Note that the
ItemTemplate has the 'Bind' method in the Text property of the label.
In order for the contents of the Textbox in the EditItemTemplate to be
bound similarly, the same expression is required.
As it is, Update will not change the database "modifiedby" column
value.
In order for your Update method to work you will have apply the change
programatically during the "RowUpdating" event using a statement
something like this:
e.NewValues("modifiedby") = Request.QueryString("userid")
HTW