|
Set CausesValidation = false on the hint linkbutton and it won't check the validators.
Hope that helps.
Ben
|
|
|
|
|
|
this code works for me<br />
code behind<br />
===========<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
Button1.Attributes.Add("onclick","hide()");<br />
}<br />
<br />
<br />
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
System.Threading.Thread.Sleep(5000);<br />
Response.Write("posted");<br />
}<br />
<br />
javascript<br />
==========<br />
function hide()<br />
{<br />
document.getElementById('Button1').style.visibility = 'hidden'<br />
}
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks Sylvester
thanks a lot for making the fast response and trouble for me,
now this code working fine when i remove the retrun value.
Regards,
Srinandan
|
|
|
|
|
Good evening!!
I'm developing project in asp.net 2.0 using c#.
On one of the webpages except pageload event none of the
event is getting fired.
I checked ids all the of buttons and their click events.
they are matching . I set break points at related events but as none of the events is fired it is not getting debugged .
Please suggest some solution .
Thank you.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
Are you doing something in the If Not IsPostback statement that is redirecting or something?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
The first thing that I'd suggest you do is to verify that the events are properly wired up. If your method isn't being executed, there is a good chance that the page isn't aware that your method is intended as a handler for the event. See this[^] article for more information.
Hope that helps.
--Jesse
"... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
hi,
If you have included any javascript (file / snippet) in the aspx, remove it and try. This is basically a script block. Nothing to do with code behind or debug
|
|
|
|
|
hi,please help me;
i wnats to show 12/12/07 12:00:00 AM this date type into 12/12/07 type in my gridview controle,
in my databse field the date is in 12/12/07. i get this field value into my dataset ds ,then i give gridview datasourece as ds,my grid view shows 12/12/07 12:00:00 AM type only ,how can i solve this
thanks and regards
paranthaman .D
hi,this is from D.paranthaman india
|
|
|
|
|
So if you look at your gridview in the HTML mode you will find the <Columns> node
YOu need code like this:
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lbDate" runat="server" Text='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"Date")).ToString("MM/dd/yy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Hope that helps.
Ben
-- modified at 21:11 Thursday 22nd March, 2007
|
|
|
|
|
you could use something like <%# DataBinder.Eval(Container.DataItem, "blah", "{0:dd/mm/YYYY}") %>
|
|
|
|
|
hi
i wish to say my thanks .
but i used that way but.the grid shows in full date and time
hi,this is from D.paranthaman india
|
|
|
|
|
That Would be correct.
Now if you research the concept a little further you will be able to figure out how to use the same concept to display a shortened date.
i.e
<%# DataBinder.Eval(Container.DataItem, "blah", "{dd/MM/YY}") %>
A good idea would be for you to research the concept now that I have given you, to see how you can improve on it. This would help to improve your coding abilities and understanding?
|
|
|
|
|
Hey,
Set the dataformatstring propery for that column equals "{0 }" and HTMEncode property = false. This will work
|
|
|
|
|
hi,
i have need a functionality like as soon we click the button at the moment that button will hide and after that the functionality should fire written in code behind along with that button.i am working as follows;
<script language="javascript" type="text/javascript"><br />
function check()<br />
{ <br />
document.getElementById('Button1').style.visibility= "hidden"; <br />
return false;<br />
}<br />
</script><br />
code behind as follows:
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Button1.Attributes.Add("onclick", "javascript:return check()");<br />
}<br />
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
Response.Write("success");<br />
}<br />
this not working properly.
and i have to do this for a content page having this Button1 so the problem is the the getElementById is not working.
Regards,
Srinandan..
|
|
|
|
|
When the HTML is written out to the Page, your button's ID in the HTML probably isn't "Button1". That means your javascript method will fail.
To get around this, write the javascript into a String on the Server-Side and add it to the Page by using the RegisterClientScriptBlock method. When inserting the Button's ID, use MyButton.ClientID to get the correct id.
|
|
|
|
|
if you say
return false;
the page will not submit
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks for reply
if i will make the return true then the button will hide for moment but i have need to hide for that time.
srinandan..
|
|
|
|
|
when the button again want to visible for you?
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
thanks Sylvester
As soon the button will click at the moment it should be hide after that the Button1_Click() events should fire. in this method i am check some condition if the functionality goes success then no need to show that button if functionality failure then the button should visible
its all.
regards,
Srinandan
|
|
|
|
|
in the catch block
you can make the button visible like the following line
Button1.Visible = true;
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hi Sylvester
I am doing this but this is not my problem.the problem with me when the button goes hidden in client the the server code is not firing.
Regards,
Srinandan..
|
|
|
|
|
In order to ensure that controls have a unique id on the page, ASP.NET will rename your controls as it renders them. In order for you to retrieve the id of a server control on the client side, you will need to progratically reference the ClientID property of the button.
Using the ClientID property, you could refactor your code into something like:
Client Script:<script language="javascript" type="text/javascript"> function check(buttonId) { button = document.getElementById(buttonId); if (button) { button.style.visibility = "hidden"; } return false; } </script>
Server Code:protected void Page_PreRender(object sender, EventArgs ea) { button1.Attributes.Add("onclick", String.Format("javascript:return check({0});", button1.ClientID)); }
You'll notice that I moved your setting of the button's attribute ito the PreRender event handler. One thing to keep in mind is that a control's client-side id is not final until it, and all of its parents, are added to the page's control tree. In order to accomodate control manipulation, I usually try to reference the ClientID as late in the render cycle as possible.
What I would recommend in your case, however, is simply to pass a reference to the button into your javascript function. This would eliminate any need to use getElementById at all, instead simply manipulating the reference. To do so, you could refactor into something like:
Client Script:<script language="javascript" type="text/javascript"> function check(button) { if (button) { button.style.visibility = "hidden"; } return false; } </script>
Server Code:protected void Page_Load(object sender, EventArgs ea) { button1.Attributes.Add("onclick", "javascript:return check(this);"); }
Hope that helps.
--Jesse
"... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
thanks you Jesse
but problem with here when return false then the server code is not firing
i have need to visible=hidden in client and then fire the server code
Regards,
Srinandan
|
|
|
|
|
I'm sorry, I must have misunderstood your post. If you'd like the server code to fire, simply change the javascript function to return true instead.
--Jesse
"... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|