Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
} 4 7183
Your code looks fine. Are you experiencing any problem?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"pbd22" <du*****@gmail.comwrote in message
news:11**********************@v29g2000prd.googlegr oups.com...
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}
On Oct 24, 9:49 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Your code looks fine. Are you experiencing any problem?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
"pbd22" <dush...@gmail.comwrote in message
news:11**********************@v29g2000prd.googlegr oups.com...
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}
Bruce -
Would you mind showing me how to add runat=server to the anchor tags
created in a ButtonField?
Thanks
On Oct 24, 11:03 am, pbd22 <dush...@gmail.comwrote:
On Oct 24, 9:49 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Your code looks fine. Are you experiencing any problem?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
"pbd22" <dush...@gmail.comwrote in message
news:11**********************@v29g2000prd.googlegr oups.com...
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}
Bruce -
Would you mind showing me how to add runat=server to the anchor tags
created in a ButtonField?
Thanks
I am having the same problem with your suggestion - I don't know how
to access the a tag to change its attributes.
I need to do this dynamically from the server but am a bit lost as to
how this is done. Would you mind illustrating
this?
I really appreciate it.
Thanks.
On Oct 24, 11:13 am, pbd22 <dush...@gmail.comwrote:
On Oct 24, 11:03 am, pbd22 <dush...@gmail.comwrote:
On Oct 24, 9:49 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Your code looks fine. Are you experiencing any problem?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
"pbd22" <dush...@gmail.comwrote in message
>news:11**********************@v29g2000prd.googleg roups.com...
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access it via FindControl.
the tag is nested as such:
<td></td><td><a href='#'>clicky</a></td><td></td>
My approach has been to muddle with RowDataBound but it isn't clear to
me how to do this.
Please help.
Thanks.
protected void vGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//
e.Row.Cells[1].Controls[0].Attributes.Add("onclick",
"alert(getRowText(this));return false;");
}
}
Bruce -
Would you mind showing me how to add runat=server to the anchor tags
created in a ButtonField?
Thanks
I am having the same problem with your suggestion - I don't know how
to access the a tag to change its attributes.
I need to do this dynamically from the server but am a bit lost as to
how this is done. Would you mind illustrating
this?
I really appreciate it.
Thanks.
no takers? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dipin |
last post by:
Hi All;
I have this javascript which is adding a new button to the column in
the row which is created dynamically, the innerhtml shows that the
onclick event is correctly added but it never gets...
|
by: RobG |
last post by:
I am trying to dynamically add an onclick to an element,
however I just can't get the syntax right. consider the
following function:
function doClick (evt,x) {
// do things with evt and x
}
...
|
by: abs |
last post by:
My element:
<span onclick="alert('test')" id="mySpan">test</span>
Let's say that I don't know what is in this span's onclick event. Is it
possible to add another action to this element's onclick...
|
by: Hrvoje Vrbanc |
last post by:
Hello all!
My question is the following: I add buttons (server controls)
programatically into a table cell. Example:
Dim btObnovi As Button = New Button()
celija25.Controls.Add(btObnovi)
...
|
by: Rick |
last post by:
I have a panel that I have set up to look like a command button with Text
and an image. I would like to have an onclick event that runs code in the
code behind page, not on the client.
It is...
|
by: Daz |
last post by:
Hello everyone. I am sure the answer to my question is simple, but I
can't seem to dynamically add an onClick event to my script.
I have a table which is generated dynamically, I am just...
|
by: Michael_R_Banks |
last post by:
I'm trying to dynamically build a table that allows users to remove
rows when they click a corresponding button. For some reason,
whenever I add the button to the table, it never fires the onclick...
|
by: felixch |
last post by:
Hi all,
I tried to add an OnClick event to a LinkButton by using
Attribute.sAdd, which resides in a Repeater and the Repeater is bind
with a DataTable with around 2000 records. If I try to run...
|
by: pbd22 |
last post by:
Hi.
I am trying to add an "onclick" 'event to an
anchor tag and this is proving harder than
I imagined.
The anchor HAS NO ID. And, there will be tons of them on the page. So,
I cannot access...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |