Link to home
Start Free TrialLog in
Avatar of doramail05
doramail05Flag for Malaysia

asked on

syntax error in asp.net hyperlink

syntax error found near

','questioncomment', 'resizable=no, ....

onwards.
(e.Item.FindControl("hlcomment") as HyperLink).Attributes.Add("onclick", "somename=window.open('questioncomment.aspx?qid=" + (e.Item.FindControl("lblqid") as Label).Text +
                                                                  "&qno=" + (e.Item.FindControl("lblqno") as Label).Text +
                                                                  "&childid=" + (e.Item.FindControl("lblchildid") as Label).Text','questioncomment', 'resizable=no,scrollbars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40'); somename.focus();return true;")";

Open in new window

Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Try this correct code.

Raj
(e.Item.FindControl("hlcomment") as HyperLink).Attributes.Add("onclick", "somename=window.open('questioncomment.aspx?qid=" + (e.Item.FindControl("lblqid") as Label).Text +
                                                                  "&qno=" + (e.Item.FindControl("lblqno") as Label).Text +
                                                                  "&childid='" + (e.Item.FindControl("lblchildid") as Label).Text  + "','questioncomment', 'resizable=no,scrollbars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40'); somename.focus();return true;");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ajay Sharma
Ajay Sharma
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Abaraj
Abaraj

(e.Item.FindControl("hlcomment") as HyperLink).Attributes.Add("onclick", @"somename=window.open('questioncomment.aspx?qid=" + (e.Item.FindControl("lblqid") as Label).Text +
                                                                  @"&qno=" + (e.Item.FindControl("lblqno") as Label).Text +
                                                                  @"&childid=" + (e.Item.FindControl("lblchildid") as Label).Text + "','questioncomment', 'resizable=no,scrollbars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40'); somename.focus();return true;");
Avatar of doramail05

ASKER

the hyperlink turns into normal text, but clickable to a specific setting browser windows.
(e.Item.FindControl("hlcomment") as HyperLink).Attributes.Add("onclick", @"somename=window.open('questioncomment.aspx?qid=" + (e.Item.FindControl("lblqid") as Label).Text +
                                                                  @"&qno=" + (e.Item.FindControl("lblqno") as Label).Text +
                                                                  @"&childid=" + (e.Item.FindControl("lblchildid") as Label).Text + "','questioncomment', 'resizable=no,scrollbars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40'); somename.focus();return true;");

Open in new window

in the hyperlink definition add this code

hyperlink.NavigateURL="javascript:void(0)";