{"id":127925,"date":"2023-05-04T12:55:45","date_gmt":"2023-05-04T07:25:45","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?page_id=127925"},"modified":"2024-04-12T14:15:23","modified_gmt":"2024-04-12T08:45:23","slug":"using-the-formview-control-to-insert-a-row","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/","title":{"rendered":"Using the FormView control to insert a row"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong>Using the FormView control to insert a row<\/strong><\/h4>\n\n\n\n<p>The FormView control in ASP.NET provides an easy way to insert a new row in a database table. Here are the steps to use the FormView control to insert a row:<\/p>\n\n\n\n<p>Drag and drop a FormView control from the Toolbox onto the web page.<\/p>\n\n\n\n<p>Bind the FormView control to a data source, such as a SqlDataSource.<\/p>\n\n\n\n<p>Click on the smart tag of the FormView control and select &#8220;Edit Templates&#8221;.<\/p>\n\n\n\n<p>Select the InsertItemTemplate from the dropdown list.<\/p>\n\n\n\n<p>Drag and drop the input controls you need onto the InsertItemTemplate, such as TextBox, DropDownList, and CheckBox.<\/p>\n\n\n\n<p>Bind the input controls to the corresponding database fields using data binding expressions, such as Text='&lt;%# Bind(&#8220;FieldName&#8221;) %&gt;&#8217;.<\/p>\n\n\n\n<p>Click on the smart tag of the SqlDataSource and select &#8220;Configure Data Source&#8221;.<\/p>\n\n\n\n<p>Select &#8220;Insert&#8221; as the SQL operation to perform.<\/p>\n\n\n\n<p>Map the input controls to the corresponding database parameters by setting the ControlID property of each parameter to the ID of the corresponding input control.<\/p>\n\n\n\n<p>Save the changes and switch back to the page designer view to preview the updated FormView control.<\/p>\n\n\n\n<p>When you run the page, you can enter data in the input controls and click the &#8220;Insert&#8221; button to insert a new row in the database table. Note: Make sure to handle any errors that may occur during the insertion process and provide appropriate feedback to the user.<\/p>\n\n\n\n<p>The best way to tell whether an ASP.NET page is going to work is to run it.<\/p>\n\n\n\n<p>Follow these steps to add a new movie to MyMovieCollection database:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Browse to the page (Ctrl+F5).<\/li>\n<\/ul>\n\n\n\n<p>The GridView control appears with the data, as shown in Figure 5-11.<\/p>\n\n\n\n<p>Notice also the new hyperlink below the GridView control. That\u2019s the FormView control.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg\" alt=\"Image 27\" class=\"wp-image-46122\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Click the New link.<\/li>\n<\/ul>\n\n\n\n<p>Now you are ready to add a new movie into the MyMovieCollection. As shown in figure 5-12.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-28.jpg\" alt=\"Image 28\" class=\"wp-image-46130\"\/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Enter all the details like title, description and date for a movie.<\/li>\n\n\n\n<li>Click Insert.<\/li>\n<\/ul>\n\n\n\n<p>The title appears in the GridView control, and the FormView control returns to its normal mode.<\/p>\n\n\n\n<p>Congratulations! You\u2019ve learned the final CRUD part <strong>Create<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apply for ASP.NET Certification Now!!<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/certified-aspnet-programmer\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.vskills.in\/certification\/certified-aspnet-programmer<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/asp-net\/\" target=\"_blank\" rel=\"noreferrer noopener\">Back to Tutorial<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Using the FormView control to insert a row The FormView control in ASP.NET provides an easy way to insert a new row in a database table. Here are the steps to use the FormView control to insert a row: Drag and drop a FormView control from the Toolbox onto the web page. Bind the FormView&#8230;<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3339],"tags":[],"class_list":["post-127925","page","type-page","status-publish","hentry","category-asp-net-2"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using the FormView control to insert a row - Tutorial<\/title>\n<meta name=\"description\" content=\"Using the FormView control to insert a row\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using the FormView control to insert a row - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Using the FormView control to insert a row\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:45:23+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/\",\"name\":\"Using the FormView control to insert a row - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg\",\"datePublished\":\"2023-05-04T07:25:45+00:00\",\"dateModified\":\"2024-04-12T08:45:23+00:00\",\"description\":\"Using the FormView control to insert a row\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage\",\"url\":\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg\",\"contentUrl\":\"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using the FormView control to insert a row\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using the FormView control to insert a row - Tutorial","description":"Using the FormView control to insert a row","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/","og_locale":"en_US","og_type":"article","og_title":"Using the FormView control to insert a row - Tutorial","og_description":"Using the FormView control to insert a row","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:45:23+00:00","og_image":[{"url":"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/","name":"Using the FormView control to insert a row - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg","datePublished":"2023-05-04T07:25:45+00:00","dateModified":"2024-04-12T08:45:23+00:00","description":"Using the FormView control to insert a row","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#primaryimage","url":"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg","contentUrl":"http:\/\/www.vskills.in\/lms\/wp-content\/uploads\/2016\/07\/Image-27.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/using-the-formview-control-to-insert-a-row\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Using the FormView control to insert a row"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/127925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=127925"}],"version-history":[{"count":2,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/127925\/revisions"}],"predecessor-version":[{"id":127938,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/127925\/revisions\/127938"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=127925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=127925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=127925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}