1 Replies - 1438 Views - Last Post: 25 September 2013 - 07:01 AM Rate Topic: -----

#1 itzmePoulami  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 12-March 13

Checkbox and Textbox

Posted 25 September 2013 - 01:15 AM

I have created something like this:


<table cellspacing="8">
<tr>
<td>
    <asp:CheckBox ID="CheckBox1" runat="server" Text="Sunday"/></td>
<td>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox2" runat="server" Text="Monday"/></td>
<td>
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox3" runat="server" Text="Tuesday"/></td>
<td>
    <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox4" runat="server" Text="Wednesday"/></td>
<td>
    <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox5" runat="server" Text="Thursday"/></td>
<td>
    <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox10" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox6" runat="server" Text="Friday"/></td>
<td>
    <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox12" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:CheckBox ID="CheckBox7" runat="server" Text="Saturday"/></td>
<td>
    <asp:TextBox ID="TextBox13" runat="server"></asp:TextBox></td>
<td>
    <asp:TextBox ID="TextBox14" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td></td>
<td align="right"><asp:Button ID="btnsubmit" runat="server" Text="SUBMIT" CssClass="btn btn-info widebtn"/></td>
<td></td>
</tr>
</table>




At run time, I want the user to select the day by selecting the appropriate checkbox and enter the timings for that particular day as shown below:
Attached Image


but how am i supposed to save the data, i.e, for which day what timings are entered?

CREATE TABLE [dbo].[doc_loc](
	[Doc_ID] [nvarchar](50) NULL,
	[Day] [nvarchar](10) NULL,
	[Time_From] [nvarchar](12) NULL,
	[Time_To] [nvarchar](12) NULL,
CONSTRAINT [PK_doc_loc] PRIMARY KEY CLUSTERED 



Please help.

This post has been edited by itzmePoulami: 25 September 2013 - 01:17 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Checkbox and Textbox

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9089
  • View blog
  • Posts: 34,142
  • Joined: 12-June 08

Re: Checkbox and Textbox

Posted 25 September 2013 - 07:01 AM

Since you have a hard setup on rows.. why not label your textboxes appropriately and validate who has a checkbox checked, and if checked grab those specific textboxes for the day.

IF checkboxThursday is checked THEN
  INSERT textBoxThursdayStart
  INSERT textBoxThursdayStop
END IF


.. then replicate that for each day. Sure it's tedious but sometimes that is what you need to do.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1