Ask a Question related to ASP.NET General, Design and Development.
-
Mark #1
UpdateCommand with Datalist
Hi, I have a datalist that I use to display and edit records to a user.
Datalist shown below;
visual basic
code:-----------------------------------------------------------------------
-------
<asp:datalist id="dgContributors" runat="server" DataKeyField="PersonID">
<ItemTemplate>
<%# Container.DataItem("FirstName") %>
<asp:LinkButton text="Select" CommandName="edit" Runat="server"
ID="Linkbutton1" NAME="Linkbutton1"></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFirstName" Text="<%# Container.DataItem("FirstName")
%>" Runat="server" width="100px"></asp:TextBox>
<asp:LinkButton text="Enter" CommandName="update" Runat="server"
ID="Linkbutton2" NAME="Linkbutton1"></asp:LinkButton>
</EditItemTemplate>
</asp:datalist>
----------------------------------------------------------------------------
--
I want to use the UpdateCommand to capture the new information entered into
the textbox and place this information into a database.
The code in the updateCommand is as follows
visual basic
code:-----------------------------------------------------------------------
-------
Private Sub dgContributors_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
dgContributors.UpdateCommand
Dim oFirst As TextBox
oFirst = e.Item.FindControl("txtFirstName")
' Should print out the new information entered into the textbox but does
not. It prints out the previous information
Response.write(oFirst.Text)
End Sub
----------------------------------------------------------------------------
--
The problem I am having is even though the UpdateCommand fires the value of
the textbox does not change to the newly entered information...
Thanks for any help
Cheers
MarkusJ
Mark Guest
-
DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand
When the UpdateCommand gets called on a DataGrid(1) i need to call the UpdateCommand on DataGrid(2), and when complete proceed with the reminder on... -
Not getting new values with UpdateCommand in Datagrid
Hi there. I have a datagrid on a webpage where I added a Edit Column with "Property Builder - Columns - Button Column - Edit, Update, Cancel... -
DataGrid disappears on UpdateCommand
Hi, I'm using a DataGrid with dynmically created colums. (AutoGenerateColumns=false) I call the DataGrid creation and data binding if... -
UpdateCommand not seeing value
I've used the datagrid to update data quite extensively without a problem. However, I've run into a situation where it isn't working and either I'm... -
UpdateCommand
I would like to have my datagrid's UpdateCommand fire when a user clicks a button not in the datagrid. How can I do this? Thanks, Matt -
Jos #2
Re: UpdateCommand with Datalist
"Mark" <mark@yahoo.comN0SPAM> wrote in message
news:bf5c6m$vo4$1@lust.ihug.co.nz...of> The problem I am having is even though the UpdateCommand fires the valueMy first guess: you are databinding again on postback.> the textbox does not change to the newly entered information...
Use:
If Not Page.IsPostBack Then
<databinding code here>
End If
--
Jos
Jos Guest
-
Mark #3
Re: UpdateCommand with Datalist
Hi, yep, that was it! Forgot the most basic part of the whole thing
<sheepish grin>
Thanks for your time
Cheers
Mark
Mark Guest



Reply With Quote

