Monday, 15 June 2015

asp.net - Is there any way to clear listview with javascript? -



asp.net - Is there any way to clear listview with javascript? -

<asp:listview id="lvzipcodefinder"></asp:listview>

i using listview @ modal popup. so, if modalpopup close , open, listview has cleared.... there way clear listview javascript? must cleared javascript.... please, help me..

yes can that: (on server side remove actual items dom )

just add together hidden button .aspx page:

<asp:button id="btnclearlistview" runat="server" text="button" style="display:none;" onclick="btnhidden_click" clientidmode="static" />

and in javascript when phone call close modal utilize code well.

document.getelementbyid('btnclearlistview').click();

and in code behind button have this:

protected void btnclearlistview_click(object sender, eventargs e) { listview1.items.clear(); }

you same @ time of opening modal-popup well.

(on client side using jquery)

this way disappear command rather removing actual items listview. should know if require remove server command must using server side coding.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> $(document).ready(function () { $("#submit1").click(function () { $("#lvzipcodefinder_itemplaceholdercontainer").remove(); }); }); </script> <input id="submit1" type="button" value="close popup" />

make sure listview id match javascript code above, need _itemplaceholdercontainer afterwards though

javascript asp.net listview clear

No comments:

Post a Comment