Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can fill a Input text in a row in a table.
Posted
Updated 20-Apr-11 7:05am
v2
Comments
thatraja 20-Apr-11 12:40pm    
Explain your question little bit more.
Cyrus Neah 20-Apr-11 12:58pm    
Do you mean table or GridView ?
[no name] 20-Apr-11 13:04pm    
<table>
Nish Nishant 20-Apr-11 13:06pm    
Check my reply. I assumed pure HTML in my response.
thatraja 20-Apr-11 13:46pm    
Seriously need more details so that you can get complete solution.

Pure HTML? Something like this, perhaps:

XML
<table>
    <tr>
        <td>
            <form method="POST" action="">
                <input type="submit" value="Submit" name="sub">
                <input type="reset" value="Reset" name="rst">
            </form>
        </td>
    </tr>
</table>


OP: I see that this has been downvoted, but at the moment, the answer is the most appropriate response to your question as it's curently phrased.
 
Share this answer
 
v2
You could try this. (I am not sure though, not enough info)
hope it helps

assume you have a form like this 2 tables and a button

XML
<form id="form1" runat="server">
  <div>
  </div>
  <asp:Table ID="Table1" runat="server" Height="185px" Width="341px">
  <asp:TableRow>
  <asp:TableCell ID="r1">
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></asp:TableCell>
  </asp:TableRow>
  <asp:TableRow ID="r2">
  <asp:TableCell ID="txtcell">
      <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></asp:TableCell>
  </asp:TableRow>
  </asp:Table>

<hr />


  <table id="Table2" runat="server">
  <tr>
  <td> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></asp:TableCell></td>
  </tr>
  <tr>
  <td> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></asp:TableCell></td>
  </tr>
  </table>

  <br />
  <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
  </form>









put this in your code behind

protected void Button1_Click(object sender, EventArgs e)
{ TextBox txt = (TextBox)FindControlRecursive(Table1, "TextBox1");
TextBox txt2 = (TextBox)FindControlRecursive(Table1, "TextBox2");
TextBox txt3 = (TextBox)FindControlRecursive(Table2, "TextBox3");
TextBox txt4 = (TextBox)FindControlRecursive(Table2, "TextBox4");
txt.Text = "yourvalue";
txt2.Text = "yourvalue2";
txt3.Text = "yourvalue3";
txt4.Text = "yourvalue4";
}


public Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
return Root;
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
return FoundCtl;
}
return null;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900