Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a botton ,
on button click i want to do something if user loged in in my website....

if user not loged in the onhover button it text on button should appear LOGIn
if already logged in then want fire button click event......

then how can i do....

help...
thanks
Posted
Comments
senguptaamlan 27-Mar-12 2:35am    
what U have done..and where you are stuck? please provide the code...
PKriyshnA 27-Mar-12 13:56pm    
for Live Auction website....

likewise..... www.bidjeeto.com

i want to show to user if it is not logged in in my website then he/she can not place bid without login....

so i want to show LOGIN on button hover if H3/she not logged in
if he/she loggedin the only show "BID NOW" ..........help........

for the multiple product i bind data in datalist....so buttton is in a datalist
............help

1 solution

HI ,
C#
if (!IsPostBack)
       {
           if (true)  //not loged
           {
               Button2.Attributes.Add("onMouseOver", "changeButtonText(this);");
               Button2.Attributes.Add("onmouseout", "changeButtonText2(this);");
           }
           else        //login
           {
               Button2.Click -= new EventHandler(Button2_Click);
           }
       }



ASP.NET
<script language="javascript" type="text/javascript">
    function changeButtonText(objThis) {
        if (objThis.childNodes[0]) {
            objThis.childNodes[0].nodeValue = 'new';
        }
        else if (objThis.value) {
            objThis.value = 'new';
        }
        else {
            objThis.innerHTML = 'new';
        }
    }
    function changeButtonText2(objThis) {
        if (objThis.childNodes[0]) {
            objThis.childNodes[0].nodeValue = 'loing';
        }
        else if (objThis.value) {
            objThis.value = 'loing';
        }
        else {
            objThis.innerHTML = 'loing';
        }
    }
</script>

<asp:Button ID="Button2" runat="server" Text="Button"
           onclick="Button2_Click"      />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900