This is a migrated thread and some comments may be shown as answers.

Jquery change does not stay on page

1 Answer 72 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Farhan
Top achievements
Rank 1
Farhan asked on 23 Aug 2011, 10:57 PM

Hi,
   I have just started using the Telerik controls recently had a question which was frustrating me. I have a grid with a popup edit form. Inside the edit form I want to certain table rows depending on if the user clicks a button. I have registered the Jquery library in my masterpage already, and when i click the button the change happens only for a second then dissapears and the original rows are back. How can I persist the jquery change im trying to make? I even tried with an html button but it still does the same thing.  There has to be a way to do simple functions like hide/show table rows, can someone point that out please look below. This is the table in the Edit pop up form and down below is the Radcodeblock with the javascript. Thanks in advance!

 
<table id="tblEditPopup" style="width:100%; height:100%"
  
<tr id="trProduct"
  
<td align="right"
Select Product:
</td
<td
<telerik:RadComboBox ID="cboxCustomers" runat="server" AutoPostBack="true"
<Items
<telerik:RadComboBoxItem Text="Select Product" /> 
   
<telerik:RadComboBoxItem Text="Apple" Value="Apple" /> 
  
<telerik:RadComboBoxItem Text="Bananas" Value="Bananas" /> 
</Items
</telerik:RadComboBox
</td
</tr>
  
<tr id="trService" style="display:none"
<td align="right"
Select Service:
</td
<td
  
<telerik:RadComboBox ID="cboxServices" runat="server" AutoPostBack="true"
<Items
<telerik:RadComboBoxItem Text="Select Service" /> 
<telerik:RadComboBoxItem Text="Deliver Home" Value="Delivery" />
<telerik:RadComboBoxItem Text="Order By Mail" Value="Mail" /> 
</Items
<telerik:RadComboBox>
  
</td
</tr>
<tr>
<td>

<button id="BtnService" onclick="toggle()" >Choose Service</button>

</td>
</tr>
</table>
  
  
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
  
function toggle() { 
    
$('#trProduct').css('display', 'none'); 
  
  
$('#trService').css('display', 'block'); 
}
  
</script
</telerik:RadCodeBlock
  
   
  
  

1 Answer, 1 is accepted

Sort by
0
Farhan
Top achievements
Rank 1
answered on 26 Aug 2011, 10:59 PM
I didnt get any replies from anyone but i figured it out, for some reason the function had to be called like return toggle() from the asp buttons client click event. Im not sure why but thats what got it working hope it helps someone else
Tags
Ajax
Asked by
Farhan
Top achievements
Rank 1
Answers by
Farhan
Top achievements
Rank 1
Share this question
or