Refreshing the database using C# code - c#

I have a Windows form application with few text boxes, button and a data grid view that is connected to a SQL Server database.
When the button is clicked data is entered to the database, but it does not show in the grid view. I tried refreshing the grid view, still no result.
To see the entered data I have to manually refresh the database. Then the entered data is shown in the grid view, when I run the application.
Please tell me a way to update database in the button click event. Or another way to show the data in gridview as soon as they have been entered to the database.

Related

How do I get the button dynamically programmed

I am new to the xamarin development. I am working on an app that adds the information from the SQLite database about the user. But my problem is it should dynamically create the button to show the user info after entering the info in the database.
I am able to get the information from the database and shows it on the activity but unable to create the button as shown in the picture.
I am not sure if button will solve the issue or this is a list view.
This is a list view as it is dynamically populated and also has a separator.
You can create a custom cell with a image view, text view and a disclosure indicator.You can reuse this cell within the list view.
You can go through this sample on List views.

Dynamically display the records of database in window forms

I would like to display the records of my database on the windows form.
The thing is that windows form should display whenever there is a change inside the database.
For example, if there is a new record in the database, the windows form will automatically show that new record in the datagrid view.
Any ideas or ways to implement this simply? A brief idea will do. I will research and implement more on that.
Thanks!

changes when back to Read Only Mode in form View asp.net

I'm using asp.net with c#. I want to update data Form View and it works fine.
The problem is when I click on update button and back to Read Only Mode, the other content of page are shifted to the left and the data of form view goes smaller!. how can I avoid this changes?
Thanks,

Update the database asynchronously

I have a ListView in ASP.NET where one column consists checkBoxes. I want the user to be able to these CheckBoxes directly in the list (without having to go into edit mode). How I do that, I have received answers in this question
The problem is when the user quickly press several CheckBoxes. It is only the first checkBox that is stored in the database, the other is restored. The user must for every checkBox, wait for the page updated. Is it posible to solve so that the changes are written to the database asynchronously?
You should make Ajax request using JavaScript on checkbox state change
You can use UpdatePanel to write to the database asynchronously and set Trigger to CheckedChanged event

Data table to Excel conversion leaves my server side button non responsive in SharePoint WebPart

We have a web part on which we display some data in a grid. We are exporting grid's underlying datatable to Excel and displaying Open - Save - Cancel dialouge box on click of a server side button.
Following is the code we are executing on click of server side button.
this.Page.Response.Clear();
this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls");
this.Page.Response.ContentType = "application/ms-excel";
this.Page.Response.Write("...here goes my well formated html....");
this.Page.Response.End();
Problem is that when i click on Cancel in the diaglouge box then dialogue box to Open/Save excel disappears but all the server side buttons placed on my web part becomes non responsive, on click of any of those buttons their server side click event does not get fired !!!
Any idea ?
Thanks.
i got it, I had to open the same page using window.open script which i executed using RegisterStartupScript on Server side button click event (on which i am exporting data table to excel) and on page load i will check if export to excel button was clicked then execute the above mentioned code to render excel.

Categories

Resources