简体   繁体   English

使用javascript / jquery清除gridview

[英]Clear gridview using javascript/jquery

Afternoon all. 下午全部。

Another hour, another question! 又一个小时,另一个问题!

I have the following bit of jquery up and running that essentially 'resets' control contents. 我有以下几段jquery并运行,它们实质上是“重置”控件内容的。

tbxProdAC.Attributes.Add ("onclick", "$('#txtbxHowMany').val(''); SetRadioFocus('" + radProd.ClientID + "');");

I have a gridview that pops up occasionally (don't worry, I have got that bit under control!) so what I would like to do is amend the above code so that when I click on txtProdAC, GridView1 is removed. 我有一个偶尔弹出的gridview(不用担心,我已经控制住了!),所以我想做的就是修改上面的代码,以便当我单击txtProdAC时,GridView1被删除。

Further to this, how would one implement a checked/unchecked function with jquery ie if tbxProdAC was click, radiobutton1 is unchecked? 除此之外,如何用jquery实现选中/未选中的功能,即如果单击了tbxProdAC,则选中了radiobutton1?

Again, as always, apologies for my ignorance. 再次,一如既往,对我的无知表示歉意。

$("#tbxProdAC").click(function(){

    $('#GridView1').remove(); // or .toggle() to show/hide
    $("#" + radProd.ClientID).attr("checked",false);

});

Try this: 尝试这个:

$("tbxProdAC").click(function(){
    //id gridview ending with 'GridView'
    $("table[id$='GridView']").html("");
});

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM