Asked by:
pass var to DAL on javascript function

Question
-
User1791200926 posted
Hi everybody
I am working on a news website and i want to add a comment part to each article.
so, i have a hyperlink fiels in my datagrid "comment". tried to add on click event to it to open the comment page in seprate window. dont want to use targrt=blank.
i put this on grid view row created and row databind.
HyperLink hm = (HyperLink)e.Row.FindControl("hyper");hm.Attributes.Add(
"onClick", "window.open('http://www.asp.net','Comments test','location=1,status=1,scrollbars=1,width=100px,height=100px, top=100px, left=100px')");not working. any help please????????????
and i also need the article id of this row in datagrid to retreave last comments? how to pass var on windows.open?
Monday, October 6, 2008 11:17 PM
All replies
-
User-330204900 posted
Is this a Dynamic Data website?
Tuesday, October 7, 2008 2:10 AM -
User-458035845 posted
hi ,
Ttry this
var id= 0; //get Your Rowid here
var userWidth = screen.availWidth;
var userHeight = screen.availHeight;
var settings = 'modal,scrollBars=no,resizable=no,toolbar=no,menubar=no,location=no,directories=no,';
var leftPos = (userWidth - popW) / 2,
var topPos = (userHeight - popH) / 2;
var popW = 100;
var popH = 100;
settings += 'left=' + leftPos + ',top=' + topPos + ',width=' + popW + ', height=' + popH + '';
window.open(('http://www.asp.net' + '?rowID=' + id, 'childForm', settings);
Tuesday, October 7, 2008 2:18 AM -
User-330204900 posted
Have a look at this thread where I had a solution that seems to be similar to what you require:
Hope this helps [:D]Tuesday, October 7, 2008 2:19 AM -
User1791200926 posted
Thanks mooncoder , but it did not answer my question.as i said i dont know where should i put it in the gridview. in what event?or maybe i should put it on page-load.but atill it didnt work.
is there any other way to achive this?having a link in a gridview and have on click event and pass var (row index ) in this function?
Tuesday, October 7, 2008 10:51 AM -
User1791200926 posted
thanks Steve,but it is not what i was looking for.
Tuesday, October 7, 2008 10:52 AM -
User-330204900 posted
is there any other way to achive this? having a link in a gridview and have on click event and pass var (row index ) in this function?
Hi sara1358, what I was sugesting was to use my custom property example and then call your javascript instead of just making a link [:D]
Tuesday, October 7, 2008 12:53 PM