Sanket Jain

Sanket Jain

  • NA
  • 855
  • 140.2k

Generate End IP address based on Start IP address & no. of S

Aug 6 2014 8:13 AM
I have 3 labels,3 textboxes &1 button control in my form.
2 input textbox & 1 output textbox
I have to generate end ip address depend on No. of static ip & start ip address
e.g
No of static ip=5
Start ip =192.168.10.10
then generate output as
 
end ip = 192.168.10.14
 

my aspx code is as following
********************************************************************************************

<table>
        <tr>
        <td>
        <asp:Label ID="lblNof_Static_IP" Text="No. of Static IP" runat="server"></asp:Label>
    </td>
    <td>:</td>
    <td>
    <asp:TextBox ID="txtNof_Static_IP" runat="server" Width="300px"></asp:TextBox>
    </td>
        </tr>
        <tr>
        <td>
        <asp:Label ID="lblStartIP" runat="server" Text="Start IP"></asp:Label></td>
       
        <td>:</td>
        <td>
        <asp:TextBox ID="txtStartIP" runat="server"></asp:TextBox>
       
         <asp:RegularExpressionValidator
    ValidationExpression="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
    ID="RegularExpressionValidator6" runat="server" ErrorMessage="Invalid IP !"
    ControlToValidate="txtStartIP"></asp:RegularExpressionValidator>
        </td>
        </tr>
       
        <tr>
        <td><asp:Button ID="btnGenerateIP" Text="Generate IP" runat="server"
                onclick="btnGenerateIP_Click" /></td></tr>
         
            <tr>
    <td>
    <asp:Label ID="lblEnd_IP" Text="End IP" runat="server"></asp:Label>
    </td>
    <td>:</td>
    <td>
    <asp:TextBox ID="txtEnd_IP" runat="server" Width="300px"></asp:TextBox>

    <asp:RegularExpressionValidator
    ValidationExpression="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
    ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid IP !"
    ControlToValidate="txtEnd_IP"></asp:RegularExpressionValidator>
    </td>
    </tr>     
                </table>

******************************************************************

so please help me in coding part because I just started Programming & new in programming

Answers (8)