I am trying to figure out how to get the text value from each textbox on a page that has a dynamically created number of text boxes. I need to store that value in a database row. I guess what i need is to be able to store the text box values in a collection or arrary of some sort and then be able to use textbox(i).value or something of that nature. Not really sure where to begin.
I have an ASP.NET gridview where I allow the user to edit a record. I need to validate multiple fields as one. I need to require that the user either enter a first and last name OR a company name. All three cannot be blank. Most of the sample code I am finding does not address the text boxes only being visible while the gridview is in edit mode. When not in edit mode, the text boxes do not exist so document.getElementById('<%= editFirstName.ClientID %>') throws an error upon page load.
I am creating n number of Combo boxes dynamically at run time and adding a Handler of Combo1_SelectedIndexChanged() to the combo boxes.
At run time, When I select an item from one of the Combo boxes, the event fires n times rather than 1.
So for example : If there are 5 combos created, and I select an item from my first combo, the event Combo1_SelectedIndexChanged() , fires 5 times and that is an issue for me. How can I restrict this to run only for the combo that I selected.
I have a about 6 or 7 text boxes which needs to be validated to make sure they are not empty from server side code. So how I usually do this is, check each textbox 1 by 1 to ensure that they are not empty. Are there any other efficient methods to do this? I have searched on SO and have found out that adding all the textboxes to a list and using a for each is a much better method. Are there any other ways that this can be achieved? Thanx a lot in advance :)
I have a page that allows users to upload photos and when they click the upload button it renders a few textboxes used to change the photo's information and also the displays the photo. After they are done upload photos, they can then insert all the information in each of the textboxes. Then users click the Upload button and it takes all the information and places it in the database. The problem is that when I say "get the text from these textboxes" using the textbox IDs, it tells me that those textbox IDs are not in the current context.
Using C# and SQL as the database.I have a page with a gridview and some text boxes and drop down list boxes. A user selects a record from the grid view I query the database and fill the text boxes and drop down list boxes.
Some fields get updated periodincally thus there is no data in those fields in the database until some time.
A strange thing happens.When filling data some text boxes gets a one tab spacing .
Dim objDatabase As New database objDatabase.OpenSQLConnection() Dim objAdapter As SqlDataAdapter Dim objDataset As New DataSet Dim objAdapter1 As SqlDataAdapter Dim objDataset1 As New DataSet Dim objAdapter2 As SqlDataAdapter Dim objDataset2 As New DataSet
i am using above code to generate dynamicaly textbox into grid view. I have 3 fix coloumns from database which i fetch at start of code.
Then i assigned it to datatable. in datatable according to Listbox item count i added more coloumn as per listbox items count.
then that datatable i i gave as datasourse to gridview. Now i inserted dynamicaly textbox to gridview in respective coloumn.
But after refreshing page all textboxes disappears....
I hope this is in the right sections....if not please feel free to move it. Does anyone here have examples of how to create multiple text boxes dynamically based on a search result? For example A table has 5 rows. how do I output to the screen 5 text boxes? and then get their details later? (so in a week if there are 15 rows in the table , then 15 text boxes are output) also what would be a good search term on Google for this so I can try and find other examples as the search terms i was using returned zip
I'm creating an quiz application which queries the database and extracts the questions and choices. I use dynamically created controls such as a checkbox list and fill the values dynamically. How do I do this? Right now I have these functions:
array_random_init(); this creates a 10 element integer array from 1-20 - extract_question(i): this extracts a question indexed at i in DB, I created the controls and set the appropriate text in this function. - validate_question(i); this is called by button_click and validates the question i according to DB.
I understand I have to recreate the controls in Page_init on postback, but what should it look like? Do I need to add "if IsPostBack" in page_init, or do I create the controls in page_init() and reset their properties in page_load when I use extract_question(i)? Also, I cannot seem to clear the selected boxes on postback, I added page directive "enableviewstate=false" but it doesn't work.
I have a website that sales associates access to view account information with clients. S.A's can only view information for accounts that they are tied to. Some clients have more than one account, S.A's can be tied to more than one account, but not all accounts of one client need to be tied to one S.A.
On the account info pages, I have account numbers (dynamically displayed labels) displayed of other accounts that the account client is associated with, which the S.A's can see. I'm modding this so that if the S.A has viewing permissions of any of the other accounts on that list of accounts, that instead of a label being displayed, a button directing them to that account page will display instead. In order for this to work, I have to attach a security function to the button, otherwise the page will blow out on the S.A's.
So I'm running a piece that is displaying a button instead of a label, which is working fine. My problem is when I try to attach the security event to the dynamically displayed buttons. It seems that the page just posts back and doesn't execute my code at all.
On my Page_Load, I'm running this after the buttons and labels are displayed:
For x = 0 to tblAccountList.Rows.Count - 1 'use a try to target the button, use catch to handle if it's instead a label, only one cell per row. Try Dim accountLink as Button = tblAccountList.Rows(x).Controls(0) Addhandler accountLink.Click, AddressOf Me.PermissionViewCheck Catch ex as InvalidCastException Continue For End Try Next
I don't have any code checking for postbacks or anything like that, but the "PermissionViewCheck" event never fires and just reposts the page.
I have two text boxes called starttime and endtime which are datetime sqldbtypes that I want to subtract the value to show in a duration label. I know that you can do a subtraction with datediff in t-sql to find the time difference, and I'm wondering if that's the best way to approach this. Here is the code from my default.aspx.vb page:
I'm very new to ASP.NET, how would it be possible to have a complete form with, let's say, 10 text boxes. Once the page is displayed, the user would only see the first textbox. After the user has input data into that box, the second textbox would appear. After data is input into the second textbox, the third textbox would appear and so on. I know it probably has something to do with Postback but I cannot find anything on this scenario.