asp.net - Javascript function call from ASP .NET Hyperlink NavigateURL property -


i have asp table create dynamically on page load event. in event, populate asp table titles , asp .net hyperlink control points .ashx page serve file client download.

for particular files (image files), i'd kick off javascript function open new window file displayed in it. have code this, can't javascript function work in hyperlink navigateurl property. i'm new javascript, i'm not sure i'm missing. can i'm trying to? can not use table control? help!

asp code behind

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load     dim iwineid integer      if not integer.tryparse(request.params("wineid"), iwineid) throw new invalidoperationexception("invalid request")     me.lblwinename.text = utils.getwinename(iwineid)     dim dtdocs new dsdocs.docsdatatable      using tadocs new dsdocstableadapters.docstableadapter         dtdocs = tadocs.getdatabyprodidorwineid((utils.getproduceridbywineid(iwineid)), true, iwineid)     end using      if dtdocs.rows.count = 0         me.lbldocsfound.text = "no documents available wine."     else         me.numberdocs(dtdocs)          each drdoc dsdocs.docsrow in dtdocs             dim myrow new tablerow             dim mytitlecell new tablecell             dim mydlcell new tablecell             dim myhl new hyperlink             select case drdoc.doc_type_id                 'window.open('preview.aspx?wineid=' + nwineid', 'height=' + nwindowheight + ',width=' + nwindowwidth + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=' + bscrollbars + ',resizable=' + bscrollbars + ',titlebar=no');                 case constants.doctype.bottleshot, constants.doctype.label, constants.doctype.logo                     myhl.navigateurl = "javascript:openprev('" & drdoc.doc_id & "');return false;" '"javascript:window.open('~/home/docpreview.aspx?docid=" & drdoc.doc_id '& "','_blank', 'height=600, width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,titlebar=no'"                     '"~/home/docpreview.aspx?docid=" & drdoc.doc_id                     myhl.text = "view"                 case else                     myhl.navigateurl = "~/home/docs.ashx?docid=" & drdoc.doc_id                     myhl.text = "download"             end select              mytitlecell.text = strconv(drdoc.doc_type_name, vbstrconv.propercase)             mydlcell.controls.add(myhl)             myrow.cells.add(mytitlecell)             myrow.cells.add(mydlcell)             me.tabledocs.rows.add(myrow)         next     end if end sub 

javascript

function openprev(docid){  var objwin var myurl  alert("go!"); myurl='~/home/docpreview.aspx?docid=' + docid; objwin=window.open(myurl, 'doc view', 'width=600,height=600,resizable=no,scrollbars=yes,toolbar=no'); 

}

@joeenos - that's part of it. try using 'http://www.google.com' myurl , see. happens.

and view source of html page , see generated hyperlinks like. href attribute wrong.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -