hi to all,
i have a form in asp.net (using vb.net) for creating a client list...(with clientname,address,phone etc...)
in that form i have a link button for adding additional contacts..
i want to create additional text boxes for adding additional contacts (first name ,last name,email ,phone..these fields are wanted) .when i click the link for that just display the labels and corresponding text boxes..i want more than one additional contacts.....
and i want to add these into database...as primary information into one table..and the additional contacts in another table..
now i can add a record with only one additional contact..when i click the link for additional contact i display a panel for additional contact...i can't do that ..pls help me..
Loading
shahar bhanPosted Sep 15, 2008, 1:59 AM
i am using SQL Server2000.
and i paste my html code here....i designed it as usercontrol
<
table style="width: 680px; height: 128px"> <tr> <td style="width: 676px; height: 49px;"> <asp:Label ID="lbl_msg" runat="server" Height="48px" Width="680px" Visible="False" BorderColor="MediumTurquoise" BackColor="InactiveCaptionText" BorderWidth="1px">asp:Label>td> tr> <tr> <td align ="left" style="width: 676px; height: 20px;"> <h3 class='pt'>New Clienth3> <br /> <asp:ValidationSummary ID="ValidationSummary1" runat="server" BackColor="#FFE0C0" BorderColor="Red" BorderWidth="1px" HeaderText="You must Enter the following field" Width="616px" /> <br /> <br /><
fieldset> <legend id="Legend1" runat ="server" >Your Primary Contactlegend> <br /> <asp:Panel ID="Panel2" runat="server" Height="50px" Width="125px"> <table style="width: 672px; vertical-align :middle "> <tr> <td align ="left" style="width: 84px;" > <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_org" runat="server" Text="Organization" Width="80px">asp:Label>td> <td style="width: 383px" align="left"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_org" runat="server" Width="200px">asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_org" ErrorMessage="Name" Width="56px">*asp:RequiredFieldValidator>td> tr> <tr> <td style="width: 84px" align="left"> <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_fname" runat="server" Text="Fistname" Width="32px">asp:Label>td> <td align ="left" style="width: 383px"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_fname" runat="server" TextMode="SingleLine">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px"> <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_lname" runat="server" Text="Lastname" Width="1px">asp:Label>td> <td align="left" style="width: 383px"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_lname" runat="server" Width="112px">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px"> <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_email" runat="server" Text="Email" Width="1px">asp:Label>td> <td style="width: 383px" align="left"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_email" runat="server" Width="112px">asp:TextBox> <asp:RegularExpressionValidator ControlToValidate="txt_email" ErrorMessage="email " ID="RegularExpressionValidator1" runat="server" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">asp:RegularExpressionValidator><asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Email" ControlToValidate="txt_email">*asp:RequiredFieldValidator>td> tr> <tr> <td align="left" style="width: 84px"> <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_cnt" runat="server" Text="Country" Width="1px">asp:Label>td> <td style="width: 383px" align="left"> <asp:DropDownList ID="ddl_country" runat="server" Width="152px"> asp:DropDownList>td> tr> <tr> <td style="width: 84px" align="left"> <asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_str" runat="server" Text="Street" Width="1px">asp:Label>td> <td align="left" style="width: 383px"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_st" runat="server" Width="112px">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px"><asp:Label Font-Bold="True" ForeColor="Black" ID="lbl_cty" runat="server" Text="City" Width="1px">asp:Label>td> <td align="left" style="width: 383px"><asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_city" runat="server" Width="112px">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px; height: 24px;"><asp:Label Font-Bold="True" ForeColor="Black" ID="Label1" runat="server" Text="State" Width="40px">asp:Label>td><td style="width: 383px; height: 24px;" align="left" > <asp:TextBox ID="txt_state" runat="server" BorderColor="DodgerBlue" BorderWidth="1px" Width="112px">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px"> <asp:Label ID="Label2" runat="server" Width="112px" Font-Bold="True" ForeColor="Black" Text="Post Box">asp:Label>td> <td style="width: 383px;" align="left"> <asp:TextBox BorderColor="DodgerBlue" BorderWidth="1px" ID="txt_pob" runat="server" Width="112px">asp:TextBox>td> tr> <tr> <td align="left" style="width: 84px"><asp:Label id="lbl_ph" Width="1px" runat="server" ForeColor="Black" Font-Bold="True" Text="phone">asp:Label>td> <td align="left" style="width: 383px"><asp:TextBox id="txt_ph" BorderWidth="1px" BorderColor="DodgerBlue" Width="112px" runat="server">asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txt_ph" ErrorMessage="Phone No">*asp:RequiredFieldValidator>td> tr> <tr> <td align="left" style="width: 84px"><asp:Label id="lbl_mob" Width="1px" runat="server" ForeColor="Black" Font-Bold="True" Text="Mobile">asp:Label>td> <td align="left" style="width: 383px"><asp:TextBox id="txt_mob" BorderWidth="1px" BorderColor="DodgerBlue" Width="112px" runat="server">asp:TextBox> td> tr> <tr> <td align="left" style="width: 84px"><asp:Label id="lbl_fax" Width="1px" runat="server" ForeColor="Black" Font-Bold="True" Text="Fax">asp:Label>td> <td align="left" style="width: 383px"><asp:TextBox id="txt_fax" BorderWidth="1px" BorderColor="DodgerBlue" Width="112px" runat="server">asp:TextBox> td> tr> table> asp:Panel> fieldset> <fieldset> <legend id="Legend2" runat ="server" >Additional Contactslegend> <br /> <div> <a href ="#" onclick ="")><asp:LinkButton ID="LinkButton1" runat="server">Add Another Contactasp:LinkButton>a>div> <br /> <br /> fieldset> <br /> <fieldset id="Fieldset1" runat ="server" ><br /> <center > <asp:Button ID="btn_save" runat="server" BorderColor ="DodgerBlue" Height="40px" Text="Save" Width="152px" BackColor="ActiveBorder" BorderWidth="1px" Font-Bold="True" /> <asp:Button id="btn_cancel" runat="server" BorderColor ="DodgerBlue" Text="Cancel" Width="152px" Height="40px" BackColor="ActiveBorder" BorderWidth="1px" Font-Bold="True">asp:Button>center>fieldset> td> tr> table>when i click the add addtional contact link button i want to display text boxes to enter the information for additional contacts(name,email,phone).when i click the linkbutton agai and again i want the same displays...
and after i gvae one or more contacts and when i click the save button i want to save the information in two tables..the primary contacts information in one table and additional contact information with client name in another table...and after that when i edit the information i want to display these information in same form also...
expecting ur help early as possible..
Bechir BejaouiPosted Sep 14, 2008, 9:52 AM
You can at once see the current contact but also you can view the rest of contacts issued from the data base at the gridview level, as you remark the allowPaging property is set to true, it helps you to navigate through records in your data base, rest one think, You have to tell me witch data base do you use SQL SERVER, MY SQL XML I have to know inorder to provide you the right code because each data base kind requires a particular programming trick, so answer me back in this forum to provide you the solution