Shouldn't it be + "\n $(\"#" + lnkAdd.ClientID + "\").hide(); "
Right now it looks like you are just passing it the fully qualified name of the type and not the actual ID.
JQuery to hide a button by default
-
22-07-2023 - |
Pregunta
I have 2 buttons which I want to hide by default on page load. On click of any row in the grid, I want these buttons to be visible. How can I hide the buttons using JQuery?
RadButton lnkAdd = new RadButton();
lnkAdd.ID = "BtnEdit";
lnkAdd.Text = "Edit";
container.Controls.Add(lnkAdd);
container.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "hideButtons",
"\n<script type=\"text/javascript\">"
//+ "\n$(function(){"
+ "\n$(document).ready(function{"
+ "\n $(\"#" + lnkAdd + "\").hide(); "
+ "\n return false;"
+ "\n });"
+ "\n</script>"
);
The following script is generated:
<SCRIPT type="text/javascript">
$(document).ready(function ruchi(){
$("#Telerik.Web.UI.RadButton").hide();
return false;
});
</SCRIPT>
But the buttons do not hide!
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow