3

Hi i have a table and i want to add dynamic rows to that through C# ... how can i do this.... advance thanks

3
  • 1
    Hmm. You're not giving much of information here.
    – Yves M.
    Nov 3, 2010 at 8:56
  • Can you clarify if you mean in the code behind during the page request or in the browser once the page has been rendered? The jQuery tag confuses the issue.
    – Andy Rose
    Nov 3, 2010 at 8:58
  • yes... html table, I want to add values on a button click server event Nov 3, 2010 at 10:47

2 Answers 2

6

You can add new rows in html table via javascript

<asp:Button ID="btnTest" runat="server" Text="Check" OnClientClick="javascript:return AddRow();"/>



<script type="text/javascript" >
           var mytable = document.getElementById('mytableID');
           function AddRow() {
               var row = document.createElement('tr');
               mytable.appendChild(row);
               return false;
           }
       </script>
3
  • values means? did you mean text in cells?
    – AsifQadri
    Nov 3, 2010 at 11:52
  • Yes.. i want to add form elements in to that table while saving Nov 3, 2010 at 13:02
  • @Nithesh then you should add rows at .cs side and your table should also runat="server"
    – AsifQadri
    Nov 4, 2010 at 8:09
2

Your question is not clear but m giving link so that it will save your time

http://www.dotnetspider.com/resources/17172-adding-dynamic-row-datagrid.aspx Come back with little more detail so that u get the answer in no time ,, Thank

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.