Click here to Skip to main content
15,889,335 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwhen user enter the name of category releted records should be pop up in gridview control using asp with c# Pin
developerit1-Apr-10 10:45
developerit1-Apr-10 10:45 
AnswerRe: when user enter the name of category releted records should be pop up in gridview control using asp with c# Pin
Alaric_1-Apr-10 10:49
professionalAlaric_1-Apr-10 10:49 
Questionhow to calculate total in a gridview dynamically Pin
developerit1-Apr-10 10:39
developerit1-Apr-10 10:39 
AnswerRe: how to calculate total in a gridview dynamically Pin
Alaric_1-Apr-10 10:44
professionalAlaric_1-Apr-10 10:44 
Questionhow to transfer data from one page gridview to anothe page gridview Pin
developerit1-Apr-10 10:37
developerit1-Apr-10 10:37 
AnswerRe: how to transfer data from one page gridview to anothe page gridview Pin
Alaric_1-Apr-10 10:43
professionalAlaric_1-Apr-10 10:43 
AnswerRe: how to transfer data from one page gridview to anothe page gridview Pin
jayprakash sir ji1-Apr-10 17:47
professionaljayprakash sir ji1-Apr-10 17:47 
QuestionProblem: Quirky Problem with Javascript OnClick chaining - Server code executed | Client code ignored (C# 3.5) Pin
Alaric_1-Apr-10 10:32
professionalAlaric_1-Apr-10 10:32 
Hi everybody,
I'm running into some very weird (to me) behavior when I try to chain the OnClick event of a Label to an Anchor. If that isn't self-explanatory, what I'm doing is showing a Label and hiding an Anchor. When I click on the Label, the Label clicks the Anchor.

My debugging process:
-> If I hide the Label, Show the anchor and set the function directly in the OnClick event in the a tag, executes as expected

-> If I show the Label, Hide the anchor and set the function directly in the OnClick event in the asp:label tag, executes as expected

-> If I show the Label, Hide the anchor, set the function in the anchor tag and tie the Label's OnClick event to be the PostBackClientHyperlink of the anchor, the javascript function is not executed.

Clicking the Label is triggering a PostBack, but it is not executing the client-side onclick event before doing so.
I've included the relevant code below. Does anyone have enough experience in this area to know why the Anchor's onclick event is not chained to the Label?

Page Markup
<table width="82px" cellspacing="1" cellpadding="0" bgcolor="#99BADD" runat="server">
            <tr runat="server">
                <td runat="server">
                    <table width="80px" cellspacing="0" cellpadding="0" runat="server">
                     <tr runat="server">
                        <td id="trace" bgcolor="#FFFFFF" width="80px" height="16px"  runat="server">
                            <asp:Label runat="server" visible="false" ID="lblTrace" BackColor="#99BADD" >Trace1</asp:Label>
                            <a id="hdnAnchor" visible="true" runat="server" onclick="return poop();" >Trace2</a>
                        </td>
                     </tr>
                    </table>
                </td>
            </tr>
        </table>

JavaScript function (assume that "txtSuccess" exists on the Page)
function poop()
{
document.getElementById('txtSuccess').value = "PooP";
}

Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
    lblTrace.Attributes.Add("OnClick",ClientScript.GetPostBackClientHyperlink(this.hdnAnchor, ""));
}

"I need build Skynet. Plz send code"

QuestionMessage Removed Pin
1-Apr-10 8:20
hi_everybody1-Apr-10 8:20 
AnswerRe: want to clear oops concepts in depth Pin
Not Active1-Apr-10 8:26
mentorNot Active1-Apr-10 8:26 
AnswerRe: want to clear oops concepts in depth Pin
Alaric_1-Apr-10 11:13
professionalAlaric_1-Apr-10 11:13 
AnswerRe: want to clear oops concepts in depth Pin
Muhammad Gouda2-Apr-10 4:59
Muhammad Gouda2-Apr-10 4:59 
QuestionDetect an external email address Pin
Dayekh1-Apr-10 5:01
Dayekh1-Apr-10 5:01 
AnswerRe: Detect an external email address Pin
JHizzle1-Apr-10 5:07
JHizzle1-Apr-10 5:07 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:16
Dayekh1-Apr-10 5:16 
GeneralRe: Detect an external email address Pin
JHizzle1-Apr-10 5:24
JHizzle1-Apr-10 5:24 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:54
Dayekh1-Apr-10 5:54 
Questioncross platform feature of asp.net Pin
ships_agr1-Apr-10 3:43
ships_agr1-Apr-10 3:43 
AnswerRe: cross platform feature of asp.net Pin
JHizzle1-Apr-10 4:04
JHizzle1-Apr-10 4:04 
AnswerRe: cross platform feature of asp.net Pin
MyDevBank1-Apr-10 4:35
MyDevBank1-Apr-10 4:35 
AnswerRe: cross platform feature of asp.net Pin
T M Gray1-Apr-10 5:41
T M Gray1-Apr-10 5:41 
QuestionProblem regarding Icallback & Viewstate Pin
Tridip Bhattacharjee1-Apr-10 3:03
professionalTridip Bhattacharjee1-Apr-10 3:03 
AnswerRe: Problem regarding Icallback & Viewstate Pin
Not Active1-Apr-10 3:38
mentorNot Active1-Apr-10 3:38 
QuestionReg IIS Pin
sowjanya331-Mar-10 23:41
sowjanya331-Mar-10 23:41 
AnswerRe: Reg IIS [modified] Pin
JHizzle31-Mar-10 23:51
JHizzle31-Mar-10 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.