Reputation: 657
I'm using a hyperlink
like this to delete
a directory
when it is clicked.
Response.Write("<a href= delete.aspx?path=" +
directory.FullName + ">DELETE </a>");
}
But for this I'm being redirected to delete.aspx
.Can I do it like button where path will be passed as parameters for the onclick
function.
Upvotes: 0
Views: 1363
Reputation: 230
<asp:LinkButton />
with onclick event and CommandName and CommandArguments properties?
Upvotes: 1
Reputation: 458
are you looking for,
string page = "delete.aspx";
Response.Write("<a href= "+page+"?path=" +directory.FullName + ">DELETE </a>");
you can decide the value for page string
Upvotes: 0
Reputation: 4081
In the "Delete.aspx" page you must be fetching the query string value and in the page load, you must be having the code to delete the directory.
Now if you don't want to do this in the "Delete.aspx" page, add a button to the current page, then just move the code present in page load of "Delete.aspx" to the button click event of the current page(in which you have the hyperlink) and use the directory value(global value) in the button_click function.
Upvotes: 1