TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
swetha sree
NA
4
3.6k
i have an asp:Table, and has 12 rows. now i want to insert 12 rows in a single button click
Aug 9 2012 7:02 AM
<asp:Table ID="tblstudentstrength" runat="server" BorderWidth="2px" CssClass="gradient-with-stop" Enabled="false" BorderColor="black">
<asp:TableHeaderRow>
<asp:TableHeaderCell><asp:Label ID="lblclass" runat="server" Text="Class"></asp:Label></asp:TableHeaderCell>
<asp:TableHeaderCell><asp:Label ID="lblnoofstudents" runat="server" Text="No_Of_Students"></asp:Label></asp:TableHeaderCell>
<asp:TableHeaderCell><asp:Label ID="lbloptionalsubject" runat="server" Text="Optional_Subject"></asp:Label></asp:TableHeaderCell>
<asp:TableHeaderCell><asp:Label ID="lblfeeperstudent" runat="server" Text="Fee_Per_Student"></asp:Label></asp:TableHeaderCell>
<asp:TableHeaderCell><asp:Label ID="lblexampapersrequired" runat="server" Text="Exam_Papers Required"></asp:Label></asp:TableHeaderCell>
</asp:TableHeaderRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbllkg" runat="server" Text="L.K.G"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtlkgstudents" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="revlkg" runat="server" ErrorMessage="*" ControlToValidate="txtlkgstudents" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chklkgcomp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chklkgmultimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtlkgfee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="*" ControlToValidate="txtlkgfee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chklkgpapers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lblukg" runat="server" Text="U.K.G"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtukgstudents" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="*" ControlToValidate="txtukgstudents" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chkukgcomp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chkukgmultimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtukgfee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ErrorMessage="*" ControlToValidate="txtukgfee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chkukgpapers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl1" runat="server" Text="1st_class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt1students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ErrorMessage="*" ControlToValidate="txt1students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk1comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk1multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt1fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ErrorMessage="*" ControlToValidate="txt1fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk1papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl2" runat="server" Text="2nd class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt2students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" ErrorMessage="*" ControlToValidate="txt2students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk2comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk2multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt2fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" ErrorMessage="*" ControlToValidate="txt2fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk2papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl3" runat="server" Text="3rd class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt3students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator9" runat="server" ErrorMessage="*" ControlToValidate="txt3students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk3comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk3multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt3fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator10" runat="server" ErrorMessage="*" ControlToValidate="txt3fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk3papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl4" runat="server" Text="4th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt4students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator11" runat="server" ErrorMessage="*" ControlToValidate="txt4students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk4comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk4multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt4fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator12" runat="server" ErrorMessage="*" ControlToValidate="txt4fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk4papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl5" runat="server" Text="5th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt5students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator13" runat="server" ErrorMessage="*" ControlToValidate="txt5students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk5comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk5multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt5fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator14" runat="server" ErrorMessage="*" ControlToValidate="txt5fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk5papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl6" runat="server" Text="6th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt6students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator15" runat="server" ErrorMessage="*" ControlToValidate="txt6students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk6comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk6multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt6fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator16" runat="server" ErrorMessage="*" ControlToValidate="txt6fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk6papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl7" runat="server" Text="7th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt7students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator17" runat="server" ErrorMessage="*" ControlToValidate="txt7students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk7comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk7multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt7fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator18" runat="server" ErrorMessage="*" ControlToValidate="txt7fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk7papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl8" runat="server" Text="8th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt8students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator19" runat="server" ErrorMessage="*" ControlToValidate="txt8students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk8comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk8multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt8fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator20" runat="server" ErrorMessage="*" ControlToValidate="txt8fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk8papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl9" runat="server" Text="9th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt9students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator21" runat="server" ErrorMessage="*" ControlToValidate="txt9students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk9comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk9multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt9fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator22" runat="server" ErrorMessage="*" ControlToValidate="txt9fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk9papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="lbl10" runat="server" Text="10th class"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt10students" runat="server" Width="70px" BackColor="#D6D6D6"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator23" runat="server" ErrorMessage="*" ControlToValidate="txt10students" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk10comp" runat="server" Text="Computers" /><br /><asp:CheckBox ID="chk10multimedia" runat="server" Text="Multimedia" />
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txt10fee" runat="server" Width="70px" BackColor="#D6D6D6" Enabled="false"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator24" runat="server" ErrorMessage="*" ControlToValidate="txt10fee" ValidationExpression="^([0-9])*$" ></asp:RegularExpressionValidator>
</asp:TableCell>
<asp:TableCell>
<asp:CheckBox ID="chk10papers" runat="server" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<table border="0" cellpadding="0" cellspacing="0" width="50%">
<tr>
<td style="font-family:Verdana; font-size:12px; width: 131px; height: 28px;"></td>
<td style="font-family:Verdana; font-size:12px; width: 131px; height: 28px;"></td>
<td style="font-family:Verdana; font-size:12px; width: 131px; height: 28px;"><center><asp:Button ID="btnstrength" runat="server" Text="Save" BackColor="#D6D6D6" OnClick="btnstrength_Click" Enabled="false" /></center></td>
<td style="font-family:Verdana; font-size:12px; width: 131px; height: 28px;"></td>
<td style="font-family:Verdana; font-size:12px; width: 131px; height: 28px;"></td>
</tr>
</table>
and in click event i wrote
protected void btnstrength_Click(object sender, EventArgs e)
{
ArrayList cells = new ArrayList();
Table t = (Table)form1.FindControl("tblstudentstrength");
foreach (TableRow r in t.Rows)
{
foreach (TableCell cell in r.Cells)
{
cells.Add(cell.ToString());
}
}
}
after this what i have to do
Reply
Answers (
1
)
Accesing External website
i have an asp:Table with 12 rows, I want to insert 12 rows in a single button click