Security of ASP.Net controls. For instance, if I have a DropDownList with 3 selections, when a user submits the form does ASP.Net validate that the value selected from the DropDown is a legitimate value and was not tampered with? For instance, the choices in the DropDown were 1, 2, and 3 but the user manipulated the form data when posting to make the value a 4. Will ASP catch it before it gets to my code behind?
I believe I read somewhere in my travels that ASP.Net has built in security to handle this but I just wanted to verify.
I've made a small site which purpose is to allow people to add members to their clan. The page has a dropdown list with the names of all available clans.
The name of the clans and the clan password come from a text file which is read when loading the page (but not when there's a page postback) and adds the clans to the dropdownlist.
The clan name and clan password are also read into an array for later use.
When the user selects an item in the dropdownlist I want to get the index so I know which clan name to use and which password.
I tried getting the index by using the indexchanged event and also just the click event of a button but somehow this doesn't seem to be working properly.
When the user filled in all fields and hits the submit button I want to check if the password is correct and want to know the clanname. I'm trying to do this by using the array's with that data and setting the item of the array equal to the index of the selected item in the dropdownlist.
But when I press the button I keep getting a wrong password error even though it's correct. If I remove the password check and submit it then the form should create or append to a text file with the name of the clan. But when submitted the text files is .txt instead of clanname.txt.
Tried setting the dropdown to autopost back or without and get the same result.
My code is the following:
reading the data into the array + adding the clannames to the dropdownlist
vb Code: Dim data() As String  Dim clanname(50) As String  Dim clanpass(50) As String Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load     Dim fileName As String = "C:/ClientSites/data/clans.txt"   Â
[Code] ....
The submit button code
vb Code: Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click     naam = txtMemberName.Text.ToString    gamertag = txtGamerTag.Text.ToString    platform = txtPlatform.Text.ToString     index = DropDownList1.SelectedIndex     paswoord = clanpass(index)            Â
[Code] ....
In short I load in data from a file into two arrays, clanpass and clanname. Populate the dropdown with the clannames. Then upon submitting I want to check the password against the password for the selected item by using it's index. I also want the name to write it to the correct text file.
I have a drop down list on the website I'm currently working on and would like to filter the results displayed based on the logged in user.An example of what I'm wanting to do is, lets say Jane's logged into this site when she clicks onto the drop down list it will only display items based upon what is associated with her login name on the table I'm pointing this drop down list to. I'm linking this drop down list up using a Linq DataSource.
I have a drop-down list that is dynamically filled with a set of values. By viewing the source code in the browser I can tell that this list is correctly filled with the "value" and "text" parameters.
But if I try to retrieve the value using ddl.SelectedItem.Value I get the error "Object reference not set to an instance of an object" which means that there is no parameter in "value" to retrieve ...
Page_Load() contains an "If Not IsPagePostback" in which the list is filled. I don't want to use AutoPostback = True since I want to retrieve the value-parameter when I click a "save" button. I must have missed something fundamental here that I do not grasp ...
The code to fill the list looks like this:
Code: Dim ds as Dataset () ds.ReadXml(the path to an xml file) ddl.Items.Add(New ListItem("destination", "destination")) ddl.DataSource = ds.Tables(0).DefaultView ddl.DataBind()
This snippet does not generate any errors: Everything is printed as it should!
But inside my Submit function I cannot be retrieve the parameter:
I'm trying to add a time to my database that a user picks from a drop down list but it's proving problematic. Below is the code for the drop down list and the Linq code for adding the selected time to the database.
I populate the items to the dropdownlist with values from a database. I use the .text and .value properties. It comes out right in the list. However when I try to make a button visible when selectedindexchange or selectedtextchange, nothing happens. Therefor I made the button always visible (because it´s the "add" button to the database depending on the selected item). When clicking Add I realize it´s the same value being sent to the database everytime, ie the first value of the list. So I´m thinking the selected... events isn´t working. Do you know what I´m doing wrong?
I am trying to populate (bind with a dataset) a DropDownList inside a GridView. However, when I do my DropDownList.DataSource = dataSet.. I get the following exception ( Object reference not set to an instance of an object. )
Here is my GridView in the .aspx page:
AllowPaging="True" EnableViewState="False">
Here is the code behind...
Private Sub gvTransferNumbersEN_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvTransferNumbersEN.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then Dim dsGetTransferNumbers As DataSet Dim ddlTransferNumbers As DropDownList = DirectCast(e.Row.FindControl("ddlTransferNumbers"), DropDownList)
How do I bind data from an Excel file named Book1.xlsx in Column A to a dropdownlist? I've tried like this:
Code: connExcel.Open() cmdExcel.CommandText = "SELECT distinct BCName From [Sheet1$] where BCName <> '' and ProjectName like 'Total%';" oda.SelectCommand = cmdExcel oda.Fill(dt2) connExcel.Close() dropdown1.DataSource = dt2 dropdown1.DataBind()
But the dropdown is filled with "System.Data.DataRowView" for all the 5 lines in the dropdown. How do I get the values shown instead of this? It must be some formatting of dt2 I think.
I am using code I have always used in other version of VS for binding to a list box.
After binding a dataset to a ListBox in VS 2010, render the page, and cilck any item in the list, the on change event always goes back to the first item in the list!
The following code to run the list box runs once...
I have a website with many pages and many level of user accounts, i want to give a limited access for each roles... So i was thinking of doing it this way, but I'm not sure if it's secure or if there are better ways to do it.
I will create a DB with two columns, user level (admin..) and page file name (test.aspx), and each time a page is opened it checks the db against the logged in user and the current page url.
How does the login work in the webtemplate given in visual studio 2010, I tried to set the redirection page in the login page. no control and no rerouting is available.
I am having two dropdownlist in my project,one dropdownlist for empid, another dropdownlist for month, if the user select the empid, the values are retrieved in the textbox.
In the second dropdownlist, if the user select the month in the dropdownlist it will display the leave details, its all working fine, if the user again select the first dropdownlist that means empid, I want to show the second dropdownlist as select month, how can do this.....
i use 2 dropdownlist with 2 object data source first dropdownlist to display departments name using object datasource (field to display DeptName , value of field DeptID)
second dropdownlist to display Employee name but depend on departments (field to display EmpName , value of field EmpID)
how to display employee name in dropdownlist depend on departments name in the other dropdownlist
2 tables
1 table deprtments with column (DeptID , DeptName , DeptDescription)
2 table Employee with column (EmpID , DeptID , EmpName)
I would like to populate a dropdownlist with all users who are in the Sales role. I am using the .Net Membership and Roles tables in my SQL 2005 DB (aspnet_Users, aspnet_Roles...).
I am having a 2 dropdown list, in the first dropdown I have 3company names,for each company I am having separate tables,every table have a empcode, if the user select the company name in the 1st dropdownlist, as per company selected the 2nd dropdownlist it will fill the list of employee codes as per the selection..
I've recently used the CreateUserWizard to add firstname, middlename and lastname to my aspnet_Profile table. I was wondering how I would go about placing these values in a dropdownlist (ddlEmployees) so that I may wind up with a list displaying these values concatenated, eg. Mary Anne Brant, Joseph Ezra Shultz etc. That's the firstname, middlename and lastname from the profiles table.
I have a clean installation of Windows 7 with VS2010 RTM and am trying to get the ASP.NET Development Server to work. When I run the project, the WebDev server starts and shows that it's listening on port x on localhost. I've tried:telnet to the port. The port is not listening. running netstat -o shows that the WebDev server is in fact not listening on any port. manually changing the WebDev port to a different port and restarted VS without effect. I have Windows Firewall turned off entirely and am not running any other firewall software either.