Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text-box for a user to enter his address and I need the text-box to be autocompleted with the addresses from the google maps database and Im not sure how to do this, I'm a student and this is for my assignment and this is my task. This is the code in my View/_EditCreatePartial.cshtml:
@model PrjctMngmt.Models.Conference

<script type="text/javascript">
    $(function () {
        $(".datetimepicker").datetimepicker({
            timeFormat: 'hh:mm:ss',
            dateFormat: 'dd-mm-yy'
        });
        $(".timepicker").timepicker({
            timeFormat: 'hh:mm:ss'
        });
    });
</script>

<script type="text/javascript" >
    $(document).ready(function () {
        $("#editor").markItUp(mySettings);
    });

</script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
   
    <fieldset>
        <legend>Conference</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Date)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Date, new { @class = "datetimepicker" })
            @Html.ValidationMessageFor(model => model.Date)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Duration)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Duration, new { @class = "timepicker" })
            @Html.ValidationMessageFor(model => model.Duration)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Description, new { @cols = 50, @rows = 10, @id = "editor" }) (optional)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Country)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Country)
            @Html.ValidationMessageFor(model => model.Country)
        </div>

        <div class="editor-label">
            Contact phone
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ContactPhone)
            @Html.ValidationMessageFor(model => model.ContactPhone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Organizer)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Organizer)
            @Html.ValidationMessageFor(model => model.Organizer)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Room)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Room)
            @Html.ValidationMessageFor(model => model.Room)
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
Posted
Updated 27-Sep-13 5:28am
v2

1 solution

I think you need to use Google API for .NET to accomplish this which you can download from the google website. allowe user to enter their address in the the same you can search using their DLL and show the respective result either in text you instead you can use google map to show the exact location on map.
 
Share this answer
 

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