i'm creating link dynamically. navigateurl
property of link set on call method. don't want call method before link clicked because there many of such links.
any on how appreciated. thanks.
public void createlink() { linkbutton link = new linkbutton(); link.click += new eventhandler(link_click); string key = getkey(); } private void link_click(object sender, eventargs e) { var url = getlinkurl(e.???); response.redirect(url); } public string getlinkurl(string key) { //do things retrieve url return url; }
update: many thanks, :) going use linkbutton, seen in updated code above. forgot ask: there key associated each link needed url. how can
one alternative use asp button instead of hyperlink, , bind getlinkurl
function inside click handler button. run response.redirect('yoururl')
execute link.
edit: adrian said above, linkbutton best of both worlds - styled hyperlink, can set click handler url dynamically, only when button clicked.
Comments
Post a Comment