Hi,
You need to know the "ID" of the record you selected, then with this ID you
can redirect it to the detail page and be able to fill the controls. There
are several ways of doing it, I describe you the solution more similar to
the way it was done in ASP
something like this:
... inside the DataList
<asp:button commandname="EditRecordHandler" commandargument="<%#
Container.DataItem["ID"] %>" Text="Edit"></asp:button>
and in the code behind:
protected void EditRecordHandler( object sender, CommandEventArgs e )
{
// you can also use a session variable here
Response.Redirect( "editrecord.aspx?id=" e.CommandArguments, true );
}
in the detail page you check if an ID is passed, if so you have to get this
record either from the DB or from a dataset and populate the fields as
needed.
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
[quoted text, click to view] "Mal P" <pandorastein@hotmail.com> wrote in message
news:20bc8b69.0406212254.aefe9a8@posting.google.com...
> Hi there,
>
> I'm a J2EE fellow who (as usual) has been thrown in the deep end and
> have to learn a fair chunk of the .NET platform (VS, ADO, WebForms, C#
> etc) in roughly two days. I'm doing ok so far, but am wondering on a
> better way to do something...
>
> Basically, I have a form which has a few fields the user fills in.
> When submitted, the data is stored as a row in an SQL database table.
> Then, I have another page which lists all the rows from that database
> in tabular format. I use a DataList to do the displaying.
>
> What I want to do is to have an "Edit" link next to each row which
> will then go back to my original form, with all the fields populated
> with the current values. The user can modify them, and re-submit.
>
> I fiddled with the EditTemplate for the DataList but that's not what I
> wanted - it seems to allow editing directly on my viewing only page. I
> want the user to be re-directed to the separate form page. In the end,
> due to a lack of time, I basically called the page with a get query
> (i.e. formpage.aspx?report_id=45) and used the queryString to get the
> report_id unique value of the record I wanted the fields in my form
> populated with.
>
> Anyone have a better suggestion on how to do this?
>
> Thanks everyone,
> Mal