M
Mark
Hi,
I'm just having a few problems working through the design of some
controls. Basically i want to have link (linkbutton etc) that will do
postback, in my case do a delete, but it needs your standard ID (the
primary key in the db). The way i'm doing it now is:
url link to same page:
page.aspx?command=delete&id=123
eg. return to the same page it's on
and have a method that captues this and does the delete
eg.
string isDelete = Request.Params["command"];
if(isDelete=="Delete")
{
string id = Request.Params["Room"];
doDelete(id);
}
It works, but seems a bad way to do it in terms of asp.net where other
controls do postback without such work-arounds.
The main problem i can't understand is the url in a repeater control
<asp:Repeater id="myreater" runat="server">
<ItemTemplate>
<a href="page.aspx?do=delete&id=<%#DataBinder.Eval(Container.DataItem,
"Notice_text")%>" > Delete something </a>
</ItemTemplate>
</asp:Repeater>
How would i get the individual id of the item from that link button
like in a onClick event in a datagrid control.
I'd like to just have a linkbutton that has an onClick even that takes
the id and deletes that item within the same page.
Would i have to create my own control?
Any help would be most appreciated,
thanks
I'm just having a few problems working through the design of some
controls. Basically i want to have link (linkbutton etc) that will do
postback, in my case do a delete, but it needs your standard ID (the
primary key in the db). The way i'm doing it now is:
url link to same page:
page.aspx?command=delete&id=123
eg. return to the same page it's on
and have a method that captues this and does the delete
eg.
string isDelete = Request.Params["command"];
if(isDelete=="Delete")
{
string id = Request.Params["Room"];
doDelete(id);
}
It works, but seems a bad way to do it in terms of asp.net where other
controls do postback without such work-arounds.
The main problem i can't understand is the url in a repeater control
<asp:Repeater id="myreater" runat="server">
<ItemTemplate>
<a href="page.aspx?do=delete&id=<%#DataBinder.Eval(Container.DataItem,
"Notice_text")%>" > Delete something </a>
</ItemTemplate>
</asp:Repeater>
How would i get the individual id of the item from that link button
like in a onClick event in a datagrid control.
I'd like to just have a linkbutton that has an onClick even that takes
the id and deletes that item within the same page.
Would i have to create my own control?
Any help would be most appreciated,
thanks