Click here to Skip to main content
15,888,235 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
this is my code please Help

HTML
<div class="span10 center">

                        <div class="span12">
                            <input name="txtValue" type="text" />
                            @Html.TextBox("txtValue",null, new { @class = " input-block-level", placeholder = "Add Recipient's Number" })
                        </div>
                        <div class="btn-group">
                            <button class="btn btn-success" type="submit" onclick="addItem();">Add Recipient</button>
                            <button class="btn btn-danger " type="submit" onclick="deleteValue();">Remove Recipient</button>
                        </div>
                        <br />
                        <br />
                        <div>
                            <label>Recipients </label>
                            @Html.ListBox("myListBox", new SelectList(new[] { "" }), new { name = "lstValue", style = "width: 250px; height: 160px;" })
                        </div>
                    </div>


i want to add inserted values to th list box using this javascript code

JavaScript
function addItem() {
    if (txtValue.value() != '') {
        myListBox.options.add(txtValue.value());
        txtValue.value('');
    } else {
        alert('Please Type A Recipient Contact .');
    }

    return false;
}

function removeItem() {
    var selectedIndex = ListBox1.selectedIndex();
    clearSelection();

    if (selectedIndex != -1) {
        ListBox1.options.remove(selectedIndex);
    } else {
        alert('select a Recipient to remove.');

    }

    return false;
}

function clearSelection() {
    ListBox1.selectedIndex(-1);
    ListBox1.value('');
}


so please how do i arrange to fit the MVC razor syntax... that's is were i ma having difficulties. Please Help
Posted

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