This is a migrated thread and some comments may be shown as answers.

[Solved] Asp.net MVC(Creating records by using RAD Controls)

0 Answers 6 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ramya
Top achievements
Rank 1
Ramya asked on 15 Apr 2011, 08:09 AM
HI,
Can you Please help me in solving the problem.

Controller->Homecontroller corresponding view->Home
In home controller i have used CRUD operations,followed by HTML controls.
The functionality of that page working fine.Now im trying to do that same by using rad controls
i just tried to create a new record for Radcontroller
Controller->RadController corresponding views->rad
for that i have taken radtextboxes
but here i couldnt get the values that are inserted into the radtextboxes,
throwing error like null values can not insert,insertion failed.if i use normal html for that working well.
Create.aspx in view.
 <h2>
    </h2>
    <% using (Html.BeginForm()) {%>
    <%: Html.ValidationSummary(true) %>
    <table width="80%">
        <tr>
            <td>
                <fieldset>
                    <legend style="font-family: Verdana; font-size: 12px">Create New Contacts</legend>
                    <table width="50%" border="1">
                        <tr>
                            <td>
                                <span>First Name:</span>
                            </td>
                            <td>
                               
                                <telerik:RadTextBox ID="txtFirstName" runat="server" EmptyMessage="Enter First Name">
                                </telerik:RadTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>Last Name:</span>
                            </td>
                            <td>
                                <telerik:RadTextBox ID="txtLastname" runat="server" EmptyMessage="Enter Last Name">
                                </telerik:RadTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>Phone Number:</span>
                            </td>
                            <td>
                                <telerik:RadTextBox ID="txtPhoneNumber" runat="server" EmptyMessage="Enter Phone Number">
                                </telerik:RadTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>Email:</span>
                            </td>
                            <td>
                                <telerik:RadTextBox ID="txtEmail" runat="server" EmptyMessage="Enter Email">
                                </telerik:RadTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="Left">
                                <p>
                                    <input type="submit" value="Create" class="btn" />
                                </p>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </td>
        </tr>
    </table>
    <% } %>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
RadController

  public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /Rad/Create

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create([Bind(Exclude = "Id")] TBL_MANAGER contactToCreate)
        {
               if (!ModelState.IsValid)
                return View();

            try
            {

                _entities.AddToTBL_MANAGER(contactToCreate);
                _entities.SaveChanges();
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

Thanks and Regards,
RamyaPriya.G
Tags
Grid
Asked by
Ramya
Top achievements
Rank 1
Share this question
or