|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Button ControlI am relatively new at .net applications and am having trouble doing the following. I have tried to read the help and discussion groups but cannot seem to be able to do what is required. I have a Master Page and a content page. On the content page I have: 1) a gridview (GridView1) with 4 fields Name Date AreaCode PhoneNumber 2) Button1 (Upload) 3) Button2 (Save) 4) Button3 (Select) I also have an excel spreadsheet with 4 columns (same as the gridview columns) When the user clicks Button1 (Upload), I would like to have the contents of the excel spreadsheet show on the GridView1. When the user clicks on Button2 (Save), I would like to add the data from the gridview to an SQL database table (NameInfo), I would like the gridview to be blank after the save and a message saying "data added". If the number of records added can be displayed in the message that would be great. When the user clicks on Button3 (Select), I would like to show all the records from the SQL database table (NameInfo). Any help would be much appreciated. -- Thanks. J Mehta What exactly is it that you are unable to do? You never mentioned a specific
problem in your posting. But I think my first question is what code are you using to get the data from/save the data to the Excel file? Also, is your problem really with one of the Button controls, or is the problem with something else? You need to give more details and specifics about what you really need help with. Show quoteHide quote "JMehta" <JMe***@discussions.microsoft.com> wrote in message news:5E565838-04C6-43C4-B197-35BA2BA475B4@microsoft.com... > Hi, > I am relatively new at .net applications and am having trouble doing the > following. I have tried to read the help and discussion groups but cannot > seem to be able to do what is required. > > I have a Master Page and a content page. On the content page I have: > 1) a gridview (GridView1) with 4 fields > Name > Date > AreaCode > PhoneNumber > 2) Button1 (Upload) > 3) Button2 (Save) > 4) Button3 (Select) > > I also have an excel spreadsheet with 4 columns (same as the gridview > columns) > > When the user clicks Button1 (Upload), I would like to have the contents > of > the excel spreadsheet show on the GridView1. > > When the user clicks on Button2 (Save), I would like to add the data from > the gridview to an SQL database table (NameInfo), I would like the > gridview > to be blank after the save and a message saying "data added". If the > number > of records added can be displayed in the message that would be great. > > When the user clicks on Button3 (Select), I would like to show all the > records from the SQL database table (NameInfo). > > Any help would be much appreciated. > -- > Thanks. > > J Mehta I would like to know how to:
1) import an excel spreadsheet to a gridview based on a button click; 2) how do I initiate saving data from a gridview to a database based on a button click; 3) how do I initiate a select to the gridview from a database initiated by a button click. -- Show quoteHide quoteThanks for your help. J Mehta "Nathan Sokalski" wrote: > What exactly is it that you are unable to do? You never mentioned a specific > problem in your posting. But I think my first question is what code are you > using to get the data from/save the data to the Excel file? Also, is your > problem really with one of the Button controls, or is the problem with > something else? You need to give more details and specifics about what you > really need help with. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > > "JMehta" <JMe***@discussions.microsoft.com> wrote in message > news:5E565838-04C6-43C4-B197-35BA2BA475B4@microsoft.com... > > Hi, > > I am relatively new at .net applications and am having trouble doing the > > following. I have tried to read the help and discussion groups but cannot > > seem to be able to do what is required. > > > > I have a Master Page and a content page. On the content page I have: > > 1) a gridview (GridView1) with 4 fields > > Name > > Date > > AreaCode > > PhoneNumber > > 2) Button1 (Upload) > > 3) Button2 (Save) > > 4) Button3 (Select) > > > > I also have an excel spreadsheet with 4 columns (same as the gridview > > columns) > > > > When the user clicks Button1 (Upload), I would like to have the contents > > of > > the excel spreadsheet show on the GridView1. > > > > When the user clicks on Button2 (Save), I would like to add the data from > > the gridview to an SQL database table (NameInfo), I would like the > > gridview > > to be blank after the save and a message saying "data added". If the > > number > > of records added can be displayed in the message that would be great. > > > > When the user clicks on Button3 (Select), I would like to show all the > > records from the SQL database table (NameInfo). > > > > Any help would be much appreciated. > > -- > > Thanks. > > > > J Mehta > > > When you say "based on a button click" and "initiated by a button click", do
you mean triggered by the Button.Click event? As for importing an excel spreadsheet, you will either need to find some free (or not free) .NET class that takes the data from an excel file and stores it in a .NET Collection or Array of some type. Since Excel files are not simple text files that you can simply read the way you might read an xml or csv file, the first step there is finding a way to make the data available to your application. Saving the data from the gridview to a database should be pretty simple and basic if you have ever worked with databases and GridViews in ASP.NET, you will need to be more specific about where your problem is for that. Initiating a Select statement to display new data in the GridView should be nothing more than a simple PostBack. Once again, you will need to be more specific about where your problem is. Please provide us with more details on where your problems are, and it may also help to show us what you currently have and what, if any, errors you are recieving. Good Luck! Show quoteHide quote "JMehta" <JMe***@discussions.microsoft.com> wrote in message news:354C51E4-C67A-4736-A7C6-B9297786FE5D@microsoft.com... >I would like to know how to: > 1) import an excel spreadsheet to a gridview based on a button click; > 2) how do I initiate saving data from a gridview to a database based on a > button click; > 3) how do I initiate a select to the gridview from a database initiated by > a > button click. > > -- > Thanks for your help. > > J Mehta > > > "Nathan Sokalski" wrote: > >> What exactly is it that you are unable to do? You never mentioned a >> specific >> problem in your posting. But I think my first question is what code are >> you >> using to get the data from/save the data to the Excel file? Also, is your >> problem really with one of the Button controls, or is the problem with >> something else? You need to give more details and specifics about what >> you >> really need help with. >> -- >> Nathan Sokalski >> njsokal***@hotmail.com >> http://www.nathansokalski.com/ >> >> "JMehta" <JMe***@discussions.microsoft.com> wrote in message >> news:5E565838-04C6-43C4-B197-35BA2BA475B4@microsoft.com... >> > Hi, >> > I am relatively new at .net applications and am having trouble doing >> > the >> > following. I have tried to read the help and discussion groups but >> > cannot >> > seem to be able to do what is required. >> > >> > I have a Master Page and a content page. On the content page I have: >> > 1) a gridview (GridView1) with 4 fields >> > Name >> > Date >> > AreaCode >> > PhoneNumber >> > 2) Button1 (Upload) >> > 3) Button2 (Save) >> > 4) Button3 (Select) >> > >> > I also have an excel spreadsheet with 4 columns (same as the gridview >> > columns) >> > >> > When the user clicks Button1 (Upload), I would like to have the >> > contents >> > of >> > the excel spreadsheet show on the GridView1. >> > >> > When the user clicks on Button2 (Save), I would like to add the data >> > from >> > the gridview to an SQL database table (NameInfo), I would like the >> > gridview >> > to be blank after the save and a message saying "data added". If the >> > number >> > of records added can be displayed in the message that would be great. >> > >> > When the user clicks on Button3 (Select), I would like to show all the >> > records from the SQL database table (NameInfo). >> > >> > Any help would be much appreciated. >> > -- >> > Thanks. >> > >> > J Mehta >> >> >> So how would I import a csv file to a gridview based on a button.click event?
-- Show quoteHide quoteThanks for your help. J Mehta "Nathan Sokalski" wrote: > When you say "based on a button click" and "initiated by a button click", do > you mean triggered by the Button.Click event? As for importing an excel > spreadsheet, you will either need to find some free (or not free) .NET class > that takes the data from an excel file and stores it in a .NET Collection or > Array of some type. Since Excel files are not simple text files that you can > simply read the way you might read an xml or csv file, the first step there > is finding a way to make the data available to your application. Saving the > data from the gridview to a database should be pretty simple and basic if > you have ever worked with databases and GridViews in ASP.NET, you will need > to be more specific about where your problem is for that. Initiating a > Select statement to display new data in the GridView should be nothing more > than a simple PostBack. Once again, you will need to be more specific about > where your problem is. Please provide us with more details on where your > problems are, and it may also help to show us what you currently have and > what, if any, errors you are recieving. Good Luck! > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > > "JMehta" <JMe***@discussions.microsoft.com> wrote in message > news:354C51E4-C67A-4736-A7C6-B9297786FE5D@microsoft.com... > >I would like to know how to: > > 1) import an excel spreadsheet to a gridview based on a button click; > > 2) how do I initiate saving data from a gridview to a database based on a > > button click; > > 3) how do I initiate a select to the gridview from a database initiated by > > a > > button click. > > > > -- > > Thanks for your help. > > > > J Mehta > > > > > > "Nathan Sokalski" wrote: > > > >> What exactly is it that you are unable to do? You never mentioned a > >> specific > >> problem in your posting. But I think my first question is what code are > >> you > >> using to get the data from/save the data to the Excel file? Also, is your > >> problem really with one of the Button controls, or is the problem with > >> something else? You need to give more details and specifics about what > >> you > >> really need help with. > >> -- > >> Nathan Sokalski > >> njsokal***@hotmail.com > >> http://www.nathansokalski.com/ > >> > >> "JMehta" <JMe***@discussions.microsoft.com> wrote in message > >> news:5E565838-04C6-43C4-B197-35BA2BA475B4@microsoft.com... > >> > Hi, > >> > I am relatively new at .net applications and am having trouble doing > >> > the > >> > following. I have tried to read the help and discussion groups but > >> > cannot > >> > seem to be able to do what is required. > >> > > >> > I have a Master Page and a content page. On the content page I have: > >> > 1) a gridview (GridView1) with 4 fields > >> > Name > >> > Date > >> > AreaCode > >> > PhoneNumber > >> > 2) Button1 (Upload) > >> > 3) Button2 (Save) > >> > 4) Button3 (Select) > >> > > >> > I also have an excel spreadsheet with 4 columns (same as the gridview > >> > columns) > >> > > >> > When the user clicks Button1 (Upload), I would like to have the > >> > contents > >> > of > >> > the excel spreadsheet show on the GridView1. > >> > > >> > When the user clicks on Button2 (Save), I would like to add the data > >> > from > >> > the gridview to an SQL database table (NameInfo), I would like the > >> > gridview > >> > to be blank after the save and a message saying "data added". If the > >> > number > >> > of records added can be displayed in the message that would be great. > >> > > >> > When the user clicks on Button3 (Select), I would like to show all the > >> > records from the SQL database table (NameInfo). > >> > > >> > Any help would be much appreciated. > >> > -- > >> > Thanks. > >> > > >> > J Mehta > >> > >> > >> > > > In the Button.Click event handler, read in the data from a *.csv file using
a StreamReader. You will need to parse the data and store it in a variable of a type that you can use as a datasource for your GridView. Show quoteHide quote "JMehta" <JMe***@discussions.microsoft.com> wrote in message news:86B938DD-ED78-4E65-BE67-4502BD2F80AF@microsoft.com... > So how would I import a csv file to a gridview based on a button.click > event? > -- > Thanks for your help. > > J Mehta > > > "Nathan Sokalski" wrote: > >> When you say "based on a button click" and "initiated by a button click", >> do >> you mean triggered by the Button.Click event? As for importing an excel >> spreadsheet, you will either need to find some free (or not free) .NET >> class >> that takes the data from an excel file and stores it in a .NET Collection >> or >> Array of some type. Since Excel files are not simple text files that you >> can >> simply read the way you might read an xml or csv file, the first step >> there >> is finding a way to make the data available to your application. Saving >> the >> data from the gridview to a database should be pretty simple and basic if >> you have ever worked with databases and GridViews in ASP.NET, you will >> need >> to be more specific about where your problem is for that. Initiating a >> Select statement to display new data in the GridView should be nothing >> more >> than a simple PostBack. Once again, you will need to be more specific >> about >> where your problem is. Please provide us with more details on where your >> problems are, and it may also help to show us what you currently have and >> what, if any, errors you are recieving. Good Luck! >> -- >> Nathan Sokalski >> njsokal***@hotmail.com >> http://www.nathansokalski.com/ >> >> "JMehta" <JMe***@discussions.microsoft.com> wrote in message >> news:354C51E4-C67A-4736-A7C6-B9297786FE5D@microsoft.com... >> >I would like to know how to: >> > 1) import an excel spreadsheet to a gridview based on a button click; >> > 2) how do I initiate saving data from a gridview to a database based on >> > a >> > button click; >> > 3) how do I initiate a select to the gridview from a database initiated >> > by >> > a >> > button click. >> > >> > -- >> > Thanks for your help. >> > >> > J Mehta >> > >> > >> > "Nathan Sokalski" wrote: >> > >> >> What exactly is it that you are unable to do? You never mentioned a >> >> specific >> >> problem in your posting. But I think my first question is what code >> >> are >> >> you >> >> using to get the data from/save the data to the Excel file? Also, is >> >> your >> >> problem really with one of the Button controls, or is the problem with >> >> something else? You need to give more details and specifics about what >> >> you >> >> really need help with. >> >> -- >> >> Nathan Sokalski >> >> njsokal***@hotmail.com >> >> http://www.nathansokalski.com/ >> >> >> >> "JMehta" <JMe***@discussions.microsoft.com> wrote in message >> >> news:5E565838-04C6-43C4-B197-35BA2BA475B4@microsoft.com... >> >> > Hi, >> >> > I am relatively new at .net applications and am having trouble doing >> >> > the >> >> > following. I have tried to read the help and discussion groups but >> >> > cannot >> >> > seem to be able to do what is required. >> >> > >> >> > I have a Master Page and a content page. On the content page I >> >> > have: >> >> > 1) a gridview (GridView1) with 4 fields >> >> > Name >> >> > Date >> >> > AreaCode >> >> > PhoneNumber >> >> > 2) Button1 (Upload) >> >> > 3) Button2 (Save) >> >> > 4) Button3 (Select) >> >> > >> >> > I also have an excel spreadsheet with 4 columns (same as the >> >> > gridview >> >> > columns) >> >> > >> >> > When the user clicks Button1 (Upload), I would like to have the >> >> > contents >> >> > of >> >> > the excel spreadsheet show on the GridView1. >> >> > >> >> > When the user clicks on Button2 (Save), I would like to add the data >> >> > from >> >> > the gridview to an SQL database table (NameInfo), I would like the >> >> > gridview >> >> > to be blank after the save and a message saying "data added". If >> >> > the >> >> > number >> >> > of records added can be displayed in the message that would be >> >> > great. >> >> > >> >> > When the user clicks on Button3 (Select), I would like to show all >> >> > the >> >> > records from the SQL database table (NameInfo). >> >> > >> >> > Any help would be much appreciated. >> >> > -- >> >> > Thanks. >> >> > >> >> > J Mehta >> >> >> >> >> >> >> >> >>
Edit XML object on web page
asp:dropdown list width asp button always rendered as type="button" vs. type="submit" Multiple controls with the same ID Upload multiple files Repeating content in master pages asp:ImageButton and onClientClick and page refresh DynamicItemTemplate not applied on programmatically added Menu Items Re: How to Reference Gridview child controls ReportViewer Control Ignoring Stylesheet in ASP.NET Web Page |
|||||||||||||||||||||||