http://www.youtube.com/user/kudvenkat...
Link for text version of this video
http://csharp-video-tutorials.blogspo...
In this video we will discuss about editing and updating data in gridview control using sqldatasource control
We will be using tblEmployee table for this demo. SQL script to create and populate this table with sample data is available in Part 13 of asp.net gridview tutorial.
Create an asp.net web application. Drag and drop a sqldatasource control and a gridview control on webform1.aspx.
Configure "SqlDataSource1" control
1. Right click on "SqlDataSource1" control and select "Show Smart Tag"
2. Now click on "Configure Data Source" link
3. Select connection string, from the dropdownlist on "Choose your data connection" screen. You need to have a connection string specified in web.config file.
4. Click Next
5. On "Configure the Select Statement" screen, select "tblEmployee" table from dropdownlist.
6. Click on "Advanced" button
7. Select "Generate INSERT, UPDATE and DELETE statements" checkbox and click OK
8. Click Next and Finish
Now flip "WebForm1.aspx" to "HTML Source" mode. Notice that, the wizard has automatically generated INSERT, UPDATE and DELETE statements. Since, we only want to enable the gridview control to eidt and update data, get rid of InsertCommand, InsertParameters, DeleteCommand, and DeleteParameters.
Now let us associate "SqlDataSource1" control with "GridView1" control
1. Right click on "GridView1" control and select "Show Smart Tag"
2. Select "SqlDataSource1" from "Choose Data Source" dropdownlist
3. Select "Enable Editing" checkbox. At this point "Edit" button should appear on the gridview control.
Now run the application. Click "Edit" button. Notice that "Update" and "Cancel" buttons are displayed, when the row is in EDIT mode. Also, notice that except "EmployeeId", all the other columns display a TextBox control, so the user can change data. By default, bound fields display a textbox control as the editing interface. It makes more sense to display a dropdownlist control as the editing interface, for "Gender" and "City". We will discuss about doing this in a later video session.
EmployeeId column is the primary key, and it is unusal to change key column values. Notice the HTML of the gridview control. The bound column that displays "EmployeeId" is marked with ReadOnly="True". This is the reason EmployeeId is not editable, when the row is in EDIT mode.
1. Click "Edit" button in a row
2. Delete the value in "Name" column
3. Click "Update"
4. Check the data for this column in the database.
Notice that NULL is stored. This is because, "BoundField" and "UpdateParameters" has a property "ConvertEmptyStringToNull". This property is true by default. If you want to store an "EmptyString" instead of NULL, set this property to false.
This property need to be set at both places.
1. On the BoundField and
2. On the respective update parameter
asp.net core docker Editing and updating data in gridview using sqldatasource control - Part 17 | |
113 Likes | 113 Dislikes |
60,840 views views | 524K followers |
Education | Upload TimePublished on 7 Mar 2013 |
Related keywords
update mysql,wcf vs web api,ado.net core,sql server management studio,webkinz,webadvisor,craigslist nj,gridview datasource,wcf one piece,asp.net core 3,ajax players,weber grill parts,webtoon,tutorials by hugo,csharp corner,mvc design pattern,asp.net machine account,servers for minecraft,asp.net core dependency injection,ado.net tutorial,update csgo,services angular,ajax ontario,update angular cli,asp.net mvc tutorial,updating whatsapp,asp.net cos'è,csharp assembly,tutorialspoint python,sql join,services briefcase,asp.net core web api,ajax jquery,wccftech,craigslist ny,gridview flutter,asp.net zero,csharp foreach,server memes,sql date format,services online,chase,updating driving licence photo,update select,serverless architecture,server resume,wcf c#,server books,gridview rowcommand,tutorialspoint javascript,mvcc connect,ado.net mysql,services technologies gps,ajax deadpool,server jobs,cvs,updating tax credits,website,mvc tutorial,costco hours,wcf service application,tutorialspoint spring,serverless,wcf soap,wcf cat,cool math games,wcf test client,updating kitchen cabinets,services & training hse colombia sas,servicestack,citibank,asp.net core identity,sql union,ajax parking,sql database,asp.net core logging,updates were rejected because the tip of your current branch is behind,gridview devexpress c#,mvconnect,cunyfirst,asp.net guida,wcf nba,csharp download,wcfi foundation,csharp online,wcf authentication,tutorials near me,http://asp.net,server 2019,chernobyl,ado.net descargar,web of dreams,serverminer,gridview pagination,ajax cleaner,ado.net visual studio 2019,webassign,ado.net vs entity framework,ado.net visual studio 2017,gridview height,csharp list,sql like,updating chrome,asp.net mvc,asp.net core tutorial,sqlite,gridview c#,wcfm,ajax roster,mvc architecture,http://ado.net,update node,asp.net core mvc,ajax soccer,server hosting,update inner join,update viajes,updating mac os,update postgresql,wcfi,updated,ajax dish soap,capital one,server rack,tutorialspoint html,csharp interface,updating bios,craigslist,webroot,tutorialspoint reactjs,ajax request,wcf dragon ball,asp.net core 2.2,updating windows 10,tutorialspoint python 3,sql developer,webster,services transmission company sas,update windows 10,sql group by,gridviewrow,asp.net core signalr,services manager,mvc framework,ajax paving,mvc near me,update traduccion,tutorialspoint spring boot,mvc map,csharp online compiler,update chrome,update from,asp.net download,sql between,ado.net c# pdf,services tag dell,wcf 2019 nba,update oracle,csharp switch,ado.net ventajas y desventajas,csharpstar,wcf tutorial,tutorialspoint,ajax meaning,csharp-video-tutorials.blogspot,tutorials dojo,central park 5,csharp string format,ado.net c#,asp.net core github,gridview android example,updating icloud settings,server status,ajax fc,server jobs nyc,asp.net core swagger,sql formatter,credit karma,services group,gridview css,gridview yii2,server error in '/' application,services windows,asp.net core 3.0,sql injection,gridview asp.net,tutorialspoint c#,wcf ria services,updating dbs,calculator,ado.net entity data model,sql insert,tutorialspoint tableau,services google play apk,sqlyog,asp.net core 3 release date,sql server,server job description,tutorials by a,update bios,servicenow,webcam,mvc hours,updating driving licence,webmd symptom,csharp array,csharp enum,ajax call,asp.net core 2. guida completa per lo sviluppatore,gridview c# asp.net,asp.net core,updating tomtom,server pro,updating driving licence address,server status ffxiv,cheap flights,webcrims,asp.net core hosting,services sas,update java,update npm,tutorialspoint java,tutorialspoint java compiler,updating raspberry pi,webmd,csharp to json,college football,ado.net dataset,csharp dictionary,cnn,website builder,tutorialspoint sql,asp.net web api,server side rendering,weber grills,sql server 2017,tutorialspoint spark,mvc nj,ado.net oracle,asp.net core download,csharp to vb.net,gridview column width,webster bank,webstaurant,updating drivers,tutorialsystems,ajax post,services fms publish announcement,gridview devexpress,services.msc no abre,ajax jersey,csharp operator,asp.net core razor pages,server duties,asp.net core environment variables,csharp random,updating driver's license,century 21,services consultores,services consulting,gridview hide column,mvcsd,services.msc,mvcsc,ado.net pdf,asp.net core configuration,ajax marvel,updating play support libraries,sql update,asp.net tutorial,mvc medical,ado.net entity data model visual studio 2019,wcfs international curriculum,mvc2,ado.net entity data model visual studio 2017,chase online,update sql,wcf api,costco,update ubuntu,server jobs near me,webex,gridview bootstrap 4,sql meaning,sql tutorial,sql commands,ado.net entity framework,ajax tavern,tutorialsteacher,ajax javascript,services desk,ajax greek,csharp tutorial,mvc pattern,ado.net sql server,ado.net connection,asp.net identity,gridview android,mvcu,gridview bootstrap,asp.net core middleware,updating esta,gridview xamarin forms,wcf web service,updating homebrew stuck,mvc webadvisor,web store,mvcc,webmail,mvci,mvctc,updating passport,
Không có nhận xét nào:
Đăng nhận xét