I usually create a datagrid in Visual Web Developer to display information from a database because it has a wizard for SQL transactions. Is there a way to program and manage the datagrid using C# as a script? Such as add or delete directly a record from the datagrid and the database is also updated? I make use of Access as my database.

Or are there other ways to do this using C# as my script? Thanks...

Recommended Answers

All 5 Replies

Look up ASP.NET and AJAX. This is what I believe you are referring to. You wish to delete a record by clicking a button on the datagrid, which in turns deletes the row (or hides it) from the datagrid, and then deletes the row from the database, all while avoiding a postback to the server, right?

Can be done and not too hard. Look it up, you'll find some tutorials on AJAX. It is becoming a web standard, so it would be great to know it.

Ok thanks a lot. I will visit the postings about my problem.

Ok thanks a lot. I will visit the postings about my problem.

hi
are you using asp.net 2005? if yes then the grid provided here is with all the functions you needed. you need not to do any code for that. everything is on default.aspx page only and not in default.c# page.
and if any one need this functionality in vb.net also then get newer version i.e 2008. :)
Best luck.

I'm usng ASP.Net 2005 (Web Developer). I am not aware that there are built in functions provided in the page. What are those functions and how can I make use of it?

Thanks...

I'm usng ASP.Net 2005 (Web Developer). I am not aware that there are built in functions provided in the page. What are those functions and how can I make use of it?

Hi ebabes,
Datagrid has built-in functionality as DataBind() and property as DataSource. You need to set DataSet, ArrayList OR Any Collection as DataSource of DataGrid object. After that you can call DataBind() method of DataGrid object.
For ex: in c#, DataGrid_Object.DataSource=DataSet_Object;
DataGrid_Object.DataBind();


There are lots of articles are available on the internet, you can search through google.
Hope this will help you.
If problem persist then feel free to ask any number of questions.
Thanks & Regards
Dilip Kumar Vishwakarma
Programmer
.Net Consulting

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.