Click here to Skip to main content
15,892,537 members
Everything / SelectedValue

SelectedValue

SelectedValue

Great Reads

by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Why DropDownList SelectedValue Does Not Work Inside SelectedIndexChanged Event?
by cpsglauco
ASP.NET GridView – OnRowDataBound vs OnRowCreated
by Mr.PoorEnglish
efficient and secure selecting from large amounts of data

Latest Articles

by Mr.PoorEnglish
efficient and secure selecting from large amounts of data
by cpsglauco
ASP.NET GridView – OnRowDataBound vs OnRowCreated
by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Why DropDownList SelectedValue Does Not Work Inside SelectedIndexChanged Event?

All Articles

Sort by Score

SelectedValue 

22 May 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Why DropDownList SelectedValue Does Not Work Inside SelectedIndexChanged Event?
7 Oct 2015 by OriginalGriff
Never mind the length of your code: that is the least of your problems!Were you aware that your users can damage or delete your database just by typing in the text boxes? Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection...
3 Jan 2017 by Wendelius
There are quite a few problems to fix. Consider the following alternativestring sql;DataSet dsa = new DataSet();DataTable dt = new DataTable();dsa.Tables.Add(dt);using (OleDbConnection connection = new OleDbConnection(connectionString)) { sql = @"SELECT * FROM [Sales Record]...
7 Feb 2018 by Maciej Los
If you would like to split listbox item into parts, use ListBox.SelectedIndexChanged Event (System.Windows.Forms)[^] Then, inside that event, paste below code: Dim curItem As String = ListBox1.SelectedItem.ToString() Dim parts As String() = curItem.Split(New String(){","},...
7 Oct 2015 by phil.o
The length does not matter so much, but your code could be refactored to get rid of these flaws:- There is no need to close then reopen the connection between each request.- Never, ever, construct SQL queries by concatenating string obtained from user inputs. This leaves your code opened...
23 Mar 2017 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Actually you have to store those selection when you click on next page. Use localstorage, cookie or something to store the ids. When you come back to the page, try to select those ids again.
7 Feb 2018 by faiqaa
I should be able to amend the data displayed in the list box, so I've planned that when selecting each row of data, this row of data would be split and copied into text boxes (txtBox1,txtBox2 and so on) I have used the code below to do so, at first it did the job however lately an error keeps...
15 Mar 2018 by Graeme_Grant
The question is made up of many moving parts. Break it down into its individual units to make it easier for you to work with: 1. Service layer: * sending mail - MS internal API or using 3rd party library; write code to send an email as a contained service * data from MS Excel - use MS Interop,...
26 Mar 2023 by Chris Copeland
The method querySelector() returns only a single HTML element as a result, or null if no possible match was found. You're using it as if it returns multiple values, which it won't. If there are multiple elements with the same name, instead use...
21 Sep 2014 by n shiva Ram
I have a strange problem,I'm working with win-form which is coding in c#..and sql serverIn a form I have a Combo-box which is collected data by the database(say 1).and later I have to Insert that particular value/member details into another database(say 2)Here My problem raises,,Once My...
23 Sep 2014 by n shiva Ram
ConnectionStringSettings consettings = ConfigurationManager.ConnectionStrings["attendancemanagement"]; string connectionString = consettings.ConnectionString; SqlConnection cn = new SqlConnection(connectionString); cn.Open(); try ...
10 Jan 2015 by cpsglauco
ASP.NET GridView – OnRowDataBound vs OnRowCreated
8 Feb 2015 by Mr J Sinha
Hello,I am trying to create a listbox with listbox items which contains some textboxes and buttons within it.My motive is to catch the value of the selected listbox item on the click of those buttons within it. here below is my xaml code
9 Feb 2015 by Jan Bakker
You are not using the listbox in a correct way.You can do the following:Let the Listbox reflect the state of your model.In that case your model class should have a Selected property.look at: Basic-MVVM-Listbox-Binding-In-WPF[^]orMake a usercontrol.The usercontrol holds your...
2 Apr 2015 by mohammad2o0
Hi I need help. I have a treeview in my project that has several treeviewitem. How to order by mvvm Selectitem. If the item is clicked on any specific text in a richtextbox display.
6 May 2015 by John C Rayan
The problem is Replace "HStateSDSUC" with your dropdownlist "DropDownList1UC". HStateSDSUC is not dropdownlist.
6 Jun 2015 by Member 11240896
Hello I have a problem in Drop Downstairs control please help meHere are tow Drop Down-list control which one of theme Bind to Province TB anther one is Bind to District TB,Now in Edit page form I want show the Province Name and District Name of that ID in Drop Down-list which...
8 Jun 2015 by Member 11240896
Hello please help me I have tow Drop Down-list Control which the are Bind to Province TB and District TBNow when user redirected with Query string to Edit page Both DropDown-list Displayed the Province Name and District Name of that user which redirected in this page,But the Problem is...
14 Jun 2015 by Member 11411753
How i can fill data in dropdownlist ?I have two tables: 1. table for employee. 2. table for country (lockup table)I need fill data in dropdwonlist and that the indicator is on the same selection employee To Update.DataTable _T2 = ins._Get_Country(); ...
16 Jun 2015 by jaket-cp
Have a read of this DropDownList article:DropDownList[^]Read the "How to" links, select the relevant framework/version when redirected.That should get you up to speed on how to use a DropDownList.
9 Jul 2015 by Member 11709123
I had an earlier question last month on dropdown issue and "F-ES SiteScore" username helped me achieve that.Click me function myFunction() { // append the whole html for a select document.getElementById("demo").innerHTML +=...
7 Oct 2015 by Member 11695623
i have this code but I think this is too long...there anything you can help meno_lab char1s t1 t2 t3 t4 avrg percn G0493/V/2015 Normal Seedling (%) 99 96 98 92 96.25 96.00G0493/V/2015 Abnormal Seedling (%) 1 4 2 7 3.50 ...
7 Oct 2015 by Patrice T
Even code 10000 times bigger will not be a problem for the compiler, but it will be a problem for you.So, for the compiler, there is no practical limit that you will reach any time soon.the only practical limit is you because soon you will be unable to maintain that huge code, and organising...
21 Dec 2015 by WitB1itz
Hi every one,I have a problem with the values returned from a multiple selected list in MVC.the returned values to the controller are as followes:SelectedCode[0] = "System.Collections.Generic.List`1[System.String]"SelectedCode[1] = "Value1"SelectedCode[2] = "Value2"I only...
22 Jun 2016 by Dave Kreskowiak
Google for "C# Access database SQL parameterized queries" to find out why what you're doing is so bad and what to do about it.You can find out more by Googling for "SQL Injection Attack".
22 Jun 2016 by BillWoodruff
"Quote:i can select data from database between dateSo, you can re-define your goal as selecting data based on midnight of the current day until midnight of then next day:private TimeSpan private TimeSpan OneTick = TimeSpan.FromTicks(1L); public DateTime StartOfToday(){ ...
25 Jun 2016 by Gustav Brock
You may need the correct format for the string expressions of the date values:" .. Where [Date] Between #" + dateTimePicker2.Value.ToString("yyyy'/'MM'/'dd") + "# And #" + dateTimePicker3.Value.ToString("yyyy'/'MM'/'dd") + "#", ..
4 Dec 2016 by H.AL
Hi all,I have a div that displays data retrieved from a web service. And there is in additional button in each row of the grid that allows the user to extract data of this row. The problem is that I don't know how to catch data selected data from AjaxData GridView. I tried this function in...
3 Jan 2017 by Member 9983063
Hello Guys, i am selecting data from database into datagridview but when i select the data so datagridview show blankWhat I have tried:connection.Open(); DataSet dsa = new DataSet(); DataTable dt = new DataTable(); dsa.Tables.Add(dt); ...
3 Jan 2017 by Pradeep Prasanna Ekanayaka
Use this code.. Don't use sql quary like this. use mysql parameters. if not codes are not genuineok try this code private void LoadData() { try { using (OleDbConnection connection = new OleDbConnection(connectionString)) ...
23 Mar 2017 by kkakadiya
Hello,I have bind records in table and applied paging in MVC View. I have checkbox(checkbox id is pID) in it. when I select some of the record in first page and click on paging and select some records in other page then previous page selected records got deselected.I am using below code...
23 Mar 2017 by kkakadiya
Thanks,For the reply but I googled and I got the solution.var str = []; function selectContractors(pID) { var test = $.map($('input[id="'+pID+'"]:checked'), function (c) { return c.value; }); //debugger; if(test.length > 0) { ...
9 Apr 2017 by Member 13116863
Hello i need update value in database , by choose a value in select menu , i try this code but didn't work
9 Apr 2017 by P_Z
Hi, Just some code improvements Add name attribute to button
21 Oct 2018 by Member 11091382
Hello, i'm studying the mvvm pattern with c#. I've a problem! I have a datagrid with an ItemSource (class "Order") and a SelectedItem ("SelectedOrder"). With a select i fill a form with the information conteined in the datagrid, but for some values i need to proposing some choice with combobox....
21 Oct 2018 by Graeme_Grant
iI did a quick Google Search: wpf datagrid combobox column binding mvvm - Google Search[^] The first result is a working answer for you: Binding a WPF DataGridComboBoxColumn with MVVM - Stack Overflow[^]
10 May 2019 by Member 14164795
I have a model "ppcc_matrix" which I've scaffolded (razor pages using EF). On my Index page, I display the entire table by default. I have two filters created for the user to narrow down this table, including a MultiSelectList "DeptList" and a SelectList "EmployeeList". When they make their...
21 May 2019 by Sheila Pontes
Hello The SelectedValue property select the value of the CatID field. Change your code for this: Dropdownlist.SelectedValue = CatID; If you want to use the CatName field to find your record in the control, use this code: Dropdownlist.SelectedIndex =...
12 Nov 2019 by Tshumore
I have a MVC Razor DropDownFor that is throwing "Object Reference not set to instance of object" when i do a Submit. Im quite not sure how this error comes about. In my Model i have: public int BankId { get; set; } public List Banks { get; set; } The method that populates...
12 Nov 2019 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which...
12 Nov 2019 by Richard Deeming
Rather than passing a FormCollection and manually binding the model, try passing the model class itself and let model binding take care of it for you: [HttpPost] public ActionResult Bank(Models.Employee.Registration bank) { if (!ModelState.IsValid) { bank.Banks = PopulateBank();...
10 Jun 2021 by Sam Pineda
I have a Quiz App where users answers some questions with a dropdownlist. The problem I have is that I can't get the selectedvalue from each dropdown. I create the dropdowns dynamically. Do someone have an idea of how I can get the values? Here...
19 Jul 2022 by Ken Schneider
I have a grid inside a stack panel. On the grid I will place several different textboxes that will show positional values that the boxes are databound from my database. I will want to have buttons to increment/decrement by small, medium, large,...
19 Jul 2022 by Graeme_Grant
It looks like you are at the beginning of learning WPF & MVVM. I strongly suggest that you do some googling for: wpf tutorials - Google Search[^] & wpf mvvm tutorials - Google Search[^] - there are a number of great free websites and youtubers...
18 Apr 2023 by DrgIonuţ
What I want to do is to enable the inputs associated with the option selected from mat-select. If the option is deselected, the input fields should be disabled. It works but not completely OK. On init, all input fields are disabled. If I select...
17 Apr 2015 by Mr.PoorEnglish
efficient and secure selecting from large amounts of data
3 Jan 2017 by OriginalGriff
Don't do it like that. Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead. With dates, this can also eliminate translation problems where the DB server...
25 Jun 2016 by Member 9983063
Hello Guys! i want to know how to select data from ms access database in c# from today date i can select data from database between date but when i select today date and get data it;s show me blank. so please help me.Here is my Code!private void button1_Click(object sender, EventArgs e) ...
26 Mar 2023 by Parvares
Hi, from the bottom of this page I'm trying to change last 'select' name from "Indice e sommario" to "Classificazione". Thank you! What I have tried: const select = document.querySelector('select[name="canale"]')[3]; select.value = 'CL';
2 Feb 2015 by Member 11240896
Hi I have many tables in my DB all of the tables are join together I write the below procedure for selecting the record from four tables that they are inner join together the result of this cod return all records, but I want select just one record where Person_Name equal to an input...
15 Mar 2018 by Member 13721474
wpf application for sending mail from datagrid values which is fetched from the excel What I have tried: i tried upto fetching excel data .i need to send mail for selected row in datagrid
21 May 2019 by Tom Paul Heart
I have two table: Category : CatID, CatName News : NewsID, CatID,Title,Content Now, i want, when i edit on table NewS, i have dropdownlist and bind all values from table Category and show SelectedValue previous Please help me What I have tried: try { ...