473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Pass Parameter to Javascript

Jay
I have javascript that accepts 2 parameters like so...

function showmsgbox(chkB, somestring)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundC olor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundC olor='whitesmoke';
}

alert(somestring);

}

I need to pass the second parameter o the function from within a datagrid
like so... Only problem is I keep getting many erros with my syntax. How
can this be accomplished?...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkBox1" onclick="javascript:HighlightRow(this, '<%#
DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

Thanks.
Nov 28 '05 #1
3 12473
I did it through the (gridview's) row event.
Using findcontrol and adding the onclick there.

However, a few days ago this kind of syntax was posted, i haven't tried it
yet.
<asp:ImageButton id="x" OnClientClick=<%# "menu('" + Eval("TableId") +
"');return false;"%> />

Maybe it helps?

"Jay" <msnews.microsoft.com> schreef in bericht
news:Op**************@TK2MSFTNGP09.phx.gbl...
I have javascript that accepts 2 parameters like so...

function showmsgbox(chkB, somestring)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundC olor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundC olor='whitesmoke';
}

alert(somestring);

}

I need to pass the second parameter o the function from within a datagrid
like so... Only problem is I keep getting many erros with my syntax. How
can this be accomplished?...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkBox1" onclick="javascript:HighlightRow(this, '<%#
DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

Thanks.

Nov 28 '05 #2
Here is the failing code regarding that post:

<asp:ImageButton ID="ImageButton2" runat="server"
OnClientClick="javascript:menu('<%# Eval("TableId")');return
false;" />

It seems menu is a function.
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...I did it through the (gridview's) row event.
Using findcontrol and adding the onclick there.

However, a few days ago this kind of syntax was posted, i haven't tried it
yet.
<asp:ImageButton id="x" OnClientClick=<%# "menu('" + Eval("TableId") +
"');return false;"%> />

Maybe it helps?

"Jay" <msnews.microsoft.com> schreef in bericht
news:Op**************@TK2MSFTNGP09.phx.gbl...
I have javascript that accepts 2 parameters like so...

function showmsgbox(chkB, somestring)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundC olor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundC olor='whitesmoke';
}

alert(somestring);

}

I need to pass the second parameter o the function from within a datagrid
like so... Only problem is I keep getting many erros with my syntax.
How can this be accomplished?...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkBox1" onclick="javascript:HighlightRow(this, '<%#
DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

Thanks.


Nov 28 '05 #3
the onclick is the serverside click. in the codebehind, you to add the
client onclick in the code behind using

checkbox.Attributes["onclick"] = value;

to add at the individual level, use the ItemDataBound Event of the repeater.

-- bruce (sqlwork.com)
"Jay" <msnews.microsoft.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
I have javascript that accepts 2 parameters like so...

function showmsgbox(chkB, somestring)
{
xState=chkB.checked;
if(xState)
{
chkB.parentElement.parentElement.style.backgroundC olor='yellow';
}
else
{
chkB.parentElement.parentElement.style.backgroundC olor='whitesmoke';
}

alert(somestring);

}

I need to pass the second parameter o the function from within a datagrid
like so... Only problem is I keep getting many erros with my syntax. How
can this be accomplished?...

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkBox1" onclick="javascript:HighlightRow(this, '<%#
DataBinder.Eval(Container, "DataItem.column1") %>'');" runat="server"
autopostback="False"/>
</ItemTemplate>
</asp:TemplateColumn>

Thanks.

Nov 28 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tony Johansson | last post by:
Hello! I use method forName and newInstance in class Class like this instance = (GameFactory)(Class.forName(name).newInstance() ); Now to my question: Assume that name is GameFactory then I...
4
by: dyw55a | last post by:
I have 2 webform in vb.NET application. On Webform1, I have one text box1 and one button. on Webform2, I have one text box . I need transfer the value of textbox 1 in webform1 to textbox2 in...
1
by: Ray | last post by:
Dear all, How to pass parameter from vb.net to Crystal Report? I'm now using ReportDocument and CrystalReportViewer. However, I don't know how to pass a parameter to the report and print the...
1
by: jindo | last post by:
Hi There! I must stresstest webservices. So I used parameter Like this 'http://aaa.bbb.ccc/services/BoardFD.asmx?op=showTable&IDno=96&tab=900'. but the parameters are not passed. how to pass...
4
by: Chakravarti Mukesh | last post by:
Hi I want to call an application and also need to pass some parameter for it. I use System.Diagnostics.Process.Start("application_path") and it runs perfectly. But when I pass paramenter like...
1
by: Tarlanim | last post by:
Hi, i'm looking for a way to pass parameter from a HTML-File to a XML-File. In HTML-File i have a reference to XML-File and i want to use the parametre from the HTML-File in XML-File (Parameter...
0
by: Ed Dror | last post by:
Hi there, I'm using Visual studio 2005 pro and I want to pass parameter from datagrid selected cell to textbox I have Select button in my datagrid I wrote this Protected Sub...
15
vinvik
by: vinvik | last post by:
hi am calling one exe from java script using window.open.. now i need to pass parameter to that exe.. and that exe accepts the parameter from command line using(variable=command$).. now how i...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
3
by: wingsganesh | last post by:
Hi Buddy, see my small example, Public Sub myPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.DrawString(" MichaelAyvazyan", Font, New SolidBrush(Color.Beige), 100, 100) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.