avoid refresh in a button click eventhttp://forums.asp.net/t/1772424.aspx/1?avoid+refresh+in+a+button+click+eventFri, 24 Feb 2012 22:08:33 -050017724244844759http://forums.asp.net/p/1772424/4844759.aspx/1?avoid+refresh+in+a+button+click+eventavoid refresh in a button click event <p>hai to all</p> <p>i wont to avoid refresh in a button click event..</p> <p>please help me</p> <p></p> <p>Thanks</p> <p>Raja.S</p> 2012-02-22T08:58:29-05:004844772http://forums.asp.net/p/1772424/4844772.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hello Mate,</p> <p>Wat u r trying to achieve?, if u dont want the entire page to be refereshed use Update Panel.</p> <p>Cheers,</p> <p>R</p> 2012-02-22T09:06:42-05:004844776http://forums.asp.net/p/1772424/4844776.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>how to use it</p> <p></p> 2012-02-22T09:08:28-05:004844781http://forums.asp.net/p/1772424/4844781.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hi Friend,</p> <p>Check</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb398864.aspx">http://msdn.microsoft.com/en-us/library/bb398864.aspx</a></p> <p><a href="http://ajax.net-tutorials.com/controls/updatepanel-control/">http://ajax.net-tutorials.com/controls/updatepanel-control/</a></p> 2012-02-22T09:11:46-05:004844786http://forums.asp.net/p/1772424/4844786.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Its very easy, below tutorial will help u</p> <p>http://ajax.net-tutorials.com/controls/updatepanel-control/</p> <p>Cheers,</p> <p>R</p> 2012-02-22T09:12:56-05:004844797http://forums.asp.net/p/1772424/4844797.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>hi Raja</p> <p><a href="http://ajax.net-tutorials.com/controls/updatepanel-control/">http://ajax.net-tutorials.com/controls/updatepanel-control/</a></p> <p>follow above link</p> <p>if this will help you please mark as answer.</p> 2012-02-22T09:15:24-05:004844834http://forums.asp.net/p/1772424/4844834.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>hi friends i use the update panel</p> <p>but its no use for me .... the page refresh is continue and redirect is not working....</p> <p>Thanks</p> <p>Raja.S</p> 2012-02-22T09:32:37-05:004844952http://forums.asp.net/p/1772424/4844952.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hi,</p> <p>Post your code.</p> 2012-02-22T10:28:01-05:004844978http://forums.asp.net/p/1772424/4844978.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hi&nbsp;</p> <p>&nbsp; <strong>&lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ContentTemplate&gt;</strong></p> <p><strong>&lt;table id=&quot;main&quot; style=&quot;margin-top: 0px; margin-left: auto&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; align=&quot;center&quot; bgcolor=&quot;#ffffff&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;</strong></p> <p><strong>&nbsp;&lt;asp:CheckBox ID=&quot;ChkAdmin&quot; Text=&quot;ADMIN&quot; runat=&quot;server&quot; AutoPostBack=&quot;true&quot; OnCheckedChanged=&quot;ChkAdmin_CheckedChanged&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TabIndex=&quot;3&quot; /&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;</strong></p> <p><strong>&lt;/tr&gt;</strong></p> <p><strong>&lt;tr&gt;</strong></p> <p><strong>&lt;td&gt;</strong></p> <p><strong>&lt;asp:Button ID=&quot;btnBack&quot; runat=&quot;server&quot; AccessKey=&quot;B&quot; CssClass=&quot;RSMenuItemColor&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnClick=&quot;btnBack_Click&quot; onmouseout=&quot;this.className='RSMenuItemColor'&quot; onmouseover=&quot;this.className='RSMenuItemOverColor'&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TabIndex=&quot;5&quot; Text=&quot;Back&quot; /&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp;&lt;asp:Button ID=&quot;btnReset&quot; runat=&quot;server&quot; AccessKey=&quot;R&quot; CssClass=&quot;RSMenuItemColor&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnClick=&quot;btnReset_Click&quot; onmouseout=&quot;this.className='RSMenuItemColor'&quot; onmouseover=&quot;this.className='RSMenuItemOverColor'&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TabIndex=&quot;5&quot; Text=&quot;Reset&quot; /&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp;&lt;asp:Button ID=&quot;btnSubmit&quot; runat=&quot;server&quot; CssClass=&quot;RSMenuItemColor&quot; OnClick=&quot;btnSubmit_Click&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onmouseout=&quot;this.className='RSMenuItemColor'&quot; onmouseover=&quot;this.className='RSMenuItemOverColor'&quot;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TabIndex=&quot;6&quot; Text=&quot;Submit&quot; /&gt;</strong></p> <p><strong>&lt;td&gt;</strong></p> <p><strong>&lt;tr&gt;</strong><strong>&lt;/table&gt;</strong></p> <p><strong>&lt;/ContentTemplate&gt;</strong><br> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/asp:UpdatePanel&gt;</strong></p> 2012-02-22T10:34:39-05:004845122http://forums.asp.net/p/1772424/4845122.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hi,</p> <p>What you want to achive exactly???</p> <p>Don't write onclick event of button. Page won't get postbacked!!!</p> 2012-02-22T11:45:39-05:004848304http://forums.asp.net/p/1772424/4848304.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p>Hi raja_durai1,</p> <p>I am not sure whether I have understood your meaning. Assuming that you don't want to refresh the CheckBox when you click the Button, you can use <strong>UpdatePanel</strong> control. However, you need to modify your code and move the CheckBox out of the UpdatePanel. In order to help you understand, I have written a demo below:</p> <p>In&nbsp;the .aspx</p> <pre class="prettyprint">&lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; /&gt; &lt;asp:UpdatePanel runat=&quot;server&quot; id=&quot;UpdatePanel&quot; updatemode=&quot;Conditional&quot;&gt; &lt;ContentTemplate&gt; &lt;asp:Label runat=&quot;server&quot; id=&quot;DateTimeLabel1&quot; /&gt; &lt;asp:Button runat=&quot;server&quot; id=&quot;UpdateButton1&quot; onclick=&quot;UpdateButton_Click&quot; text=&quot;Update&quot; /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:CheckBox ID=&quot;CheckBox1&quot; runat=&quot;server&quot; AutoPostBack=&quot;true&quot; oncheckedchanged=&quot;CheckBox1_CheckedChanged&quot; /&gt; &lt;asp:TextBox ID=&quot;TextBox1&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;</pre> <p>In the code behind</p> <pre class="prettyprint"> protected void Page_Load(object sender, EventArgs e) { TextBox1.Text = DateTime.Now.ToString(); } protected void UpdateButton_Click(object sender, EventArgs e) { DateTimeLabel1.Text = DateTime.Now.ToString(); } protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { }</pre> <p>Please test it locally. When you click the Button and CheckBox, you will find the difference.</p> <p>Note that when you set AutoPostBack=&quot;true&quot;, the event CheckBox1_CheckedChanged will occur and make a postback. When you set it false,&nbsp;it willn't do a postback.&nbsp;In addition, I would suggest you to use IE Develop Tools to debug step by step.</p> <p>Best wishes,</p> 2012-02-24T02:41:30-05:004850094http://forums.asp.net/p/1772424/4850094.aspx/1?Re+avoid+refresh+in+a+button+click+eventRe: avoid refresh in a button click event <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Vijay Giggs</h4> <p></p> <p>Hi,</p> <p>What you want to achive exactly???</p> <p>Don't write onclick event of button. Page won't get postbacked!!!</p> <p></p> </blockquote> <p></p> <p>The page will postback regardless of whether or not the button has an OnClick handler attached to it. </p> 2012-02-24T22:08:33-05:00