VS 2010 / Refresh A Database Query And Listbox?

Jun 30, 2012

I have a dropdown list which provided input to a SQLDataSource query which is bound to a listbox. When the user changes the index of the dropdown box, I want to trigger the SQQLDataSource to requery the database, and repopulate the listbox.

I have set the autopostback = true for the dropdown box. I have also added a Response.Redirect back to the same page in the SelectedIndexChanged method, but the DataSource does not Repopulate. How to trigger the requery?

View 1 Replies

Similar Messages:

Forms Data Controls :: Query About Listbox Control For Updating To Database?

Aug 11, 2010

I do have a listbox control and a button to update values of the list box with few other values of the form to the database. If i select 3 values in the listbox, it has to update the database in 3 rows (Unique for Listbox value) with the other value being the same. I use a details value for inserting values.

View 5 Replies

VS 2010 - Doing Query And Update For SQL Database

Jul 2, 2011

Here's something I've been stuck on for some time. I used code from the ADO.NET Tutorial and tried to translate it so it applies to SQL and the database on my website. I set the Configuration Manager for Debug and so I can see a detailed error message.

Here's my code:

Option Strict On
Imports System.Web.AspNetHostingPermission
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.Data.SqlDbType
Imports System.Data.Sql

[Code] .....

I have most of the lines in the DoStuff Sub commented out right now but I get the same error message either way so it's responding to the first line below Try.

Here's the error message I see. Line 52 is :

The table in Database1 that I'm trying to access is called Ray Rover Activation.

View 6 Replies

AJAX :: How To Automatically Refresh A Listbox

Jan 28, 2011

I have a update panel. Inside the Update Panel i have a listbox. how to do automatically refresh a listbox at every 2mins using ajax.

View 6 Replies

AJAX :: How To Get Listbox To Refresh In UpdatePanel

Jul 23, 2010

I have a simple ListBox and a Ajax File Upload control. I have these controls within an Update panel. But I cannot get the ListBox to update upon uploading a new file.

View 4 Replies

SQL Server :: Database Refresh Time / To Know When The Last Refresh Has Happend?

Jul 20, 2010

we have a sql server 2005...that has 70-80 databases and hundreds of tables....

It is supposed to refresh every night.... refresh is done by other vendor(3rd party).... we dont know what method(technology) they use to refresh the databases....

My question is .....

Is there a good way to know when the last refresh has happend...can we determine it from sys tables.....

the sql server is installed in window server 2003 box.... we have access to the box as well as the sql server.....

View 11 Replies

Web Forms :: How To Automatically Refresh Listbox Without Using Ajax Tool

Feb 18, 2011

I have to automatically refresh the listbox in asp.net using c#.

View 5 Replies

VS 2010 - Adding Items To ListBox

Jul 12, 2011

I've never built an ASP.NET application. At my work, we have a bunch of different PDFs, Word and Excel documents, HTML pages, etc, all in one folder. My boss has tasked me with creating a web app to combine all of these items into one interface.

Among the things I'm adding, I need to convert a VB app I made. All the app does is scan our servers for log files and displays them in a ListBox.

Before I start importing the classes and setting up the code, I decided to just add a ListBox to the page and add a ListItem during page load.

VB.NET Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    Me.lbLogs.Items.Add(New ListItem("Test", "C"))End Sub

But, an exception is thrown when I try to run it.

The example I'm using there is the example shown on MSDN. Why this is occurring?

View 13 Replies

VS 2010 - SelectedValue Of ListBox Always Null

Sep 29, 2011

I got this in my page:

<asp:ListBox runat="server" ID="lstCategories" SelectionMode="Single"></asp:ListBox>

I populate it in my code-behind correctly, and when I look at the generated source it's:

<option value="1">aaaa</option>
<option value="2">bbbb</option>

However, in my button click event, when I check waht is the selected item's value (lstCategories.SelectedItem.Value, also lstCategories.SelectedValue) I find that the selected item is always null.

the user can only select one item in the list for what it matters. (SelectionMode = Single)

View 2 Replies

Query To Change Listbox Selection Mode?

Mar 1, 2010

I have an ASP.NET page with a listbox whose selection mode is set to multiple by default. I would like to set its selection mode to single on a button click.

Code snippet of my attempt:


It is not working though. What am I doing wrong here and how to get it to work?

View 1 Replies

VS 2010 / Refresh Page Open In Another Tab?

Nov 19, 2014

I have an internal web application used by one department in our company. The app has a page with a gridview showing all inspection records for a part. When the user clicks on a record it will open that record in another tab. After they are done editing that record and click the close button I would like the original page with the gridview to refresh. Is this possible? Any examples? I've googled and checked other forums and can't seem to find any reliable method to do this.

View 1 Replies

VS 2010 - Restoring Entire Listbox From Session Variable

Dec 31, 2011

In my opening page of a web app I create (from a database get) two somewhat large datasets for 2 listboxes. I populate and databind them and all is good with the world

I then want to take those 2 listbox datasets and put them into a session variable for use on other pages of the web app. The reason is I do not want those additional hits in populating the two listboxes again (data does not change)

I am calling a class and passing back a DATASET for each listbox .. then

Session (DATASET_1) = MyClass.Dataset1
Session (DATASET_2) = MyOtherClass.DataSet2
DATASET_1 AND DATASET_2 are defines as constants with a type of DS

When I attempt to rebind the listboxes as

ListBox1.DataSource = Session( DATASET_1 ) *AS System.Data.DataSet ListBox.DataBind()

and the same deal for listbox 2 nothing happens........

View 5 Replies

VS 2010 - Adding Index To Listbox Values During Population

Jun 27, 2014

I have a SQL table used by a third party application that I have very little control over. The table contains a list of assemblies and their corresponding serial numbers. The tables primary key is a composite of the assembly number and serial number. There is no field I can use, reliably as an index.

I have an application I'm working on that pulls all the serial numbers from that table based on the assembly in a SQL View. I've then written code that pulls the serial numbers from that view based on the part number in a textbox on the form. That functionality works fine but I had both my datatextfield and datavaluefield set to the serial number. I've created another empty listbox that I would like to populate from a serial number or serial numbers being selected in the first. That is not working, I believe, because there is no index for the list.

My question is...How can I add an index value to each serial number as they populate from the SQL table. I've included the code below that I have pulling the serial number values.

This is an ASP.net VB webform.

Private Sub FillSnAvailList()
Dim strconnect1 As String = ("Data Source=MyDataSource")
Dim con1 As New SqlConnection(strconnect1)
Dim cmd1 As New SqlCommand("SELECT [sPartNum], [SerialNum] FROM [V_MaxSerialNum] WHERE ([sPartNum] = @sPartNum)", con1)

[Code] ....

View 3 Replies

SQL Server :: Prevent Injection When Using Values From A ListBox In The Query?

Sep 10, 2010

I'm using a List Box to get multiple values that will be used in a query.I can loop over the List Box and create the string.i.e. 'blue','red','purple'The string is used in the query: SELECT * FROM TABLE1 WHERE COLOR IN('blue','red','purple'). Is there a way to parametrize multiple values? @COLOR='blue','red','purple'What will be the best practice to prevent SQL injections in this scenario?

View 10 Replies

VS 2010 - Display Contents Of A File Selected From ListBox Into Text Box

Jul 18, 2011

I need to display the contents of a file selected from a ListBox into a text box. When I populate the ListBoxItems, I set the Text property to the name of the file and its full path to the Value property.

When I click the item, the page refreshes because AutoPostBack is on, but nothing happens. I then tried this:

VB.NET Code:
Protected Sub lbLogs_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lbLogs.SelectedIndexChanged      Me.txtServiceTag.Text = Me.lbLogs.SelectedItem.TextEnd Sub

But it still didn't work.

View 18 Replies

Web Forms :: Amend Single Query String To Multi-item Listbox?

Jul 26, 2010

I have this code which takes a value from a dropdown control as a parameter.


I'm now changing to a list control so that multiple items can be selected. So far I have some code that places the items selected into a string that looks like this:


For the above example I would need all the the records returned when the field action_ref contains either item1 or item2 or item3.

View 4 Replies

C# - Listbox Is Null When Passing A Query String And Processing Data On Load?

Jan 11, 2010

got a wired problem (well I find it a wired problem :P)

I have an order page done in asp.net c#, and which a user adds ingredients to a set of list boxes, once the user and finished adding items, they get combined to make a sandwich then added to another list box that shows the sandwiches and their ingredients. I also have a button to allow the user to remove the ighlighted sandwich from the order, this all works fine until the page loads up with a query string that skips the adding of ingredients and just shows the sandwiches on a order, the listbox of sandwiches populates fine but I then get an error when the remove button is clicked which is


View 2 Replies

Forms Data Controls :: How To Use Multiple Selected Values From Listbox In Sql Query

Dec 29, 2010

I want to use multiple selected values from my list box to my sql query as how can i do this

i fill my listbox with following code to use selected multiple values in my sql delete query for deleting selected records

Dim connect, strsql As String

View 2 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

VS 2010 - How To Do A Query From A Dataset

Aug 19, 2010

Can you do a query from a dataset?


Dim cmd As New SqlCommand
cmd.Connection = New SqlConnection(<connectionString here>)
cmd.CommandText = "Select * From table_name"
Dim da As New SqlDataAdapter(cmd.CommandText, cmd.Connection)
Dim ds As New DataSet
da.Fill(ds) ' I want to do some query with THIS dataset

I want to do a query based on the dataset ds. Let's say I want to filter out names that starts with "a". If yes, how do you do it?

View 11 Replies

ADO.NET :: Display Data 1 / 2010 And Get Query?

Oct 15, 2010

which datatype is needed if I want to display the data 1 / 2010 and want to get query = select min (number) as number. Do I have to use a separate number and year?

View 2 Replies

VS 2010 - Query SQL Server From Within A Class

Nov 20, 2013

I have an application where I am trying to create a Content Management System for a set of newsletters. I use a SQL server to store all content, and have the connection string in the Web.Config. I use forms to allow users to enter articles and register to receive the newsletters. The app regularly generates the newsletters and emails them out. Since the processing of the newsletters does not need a form, I was considering using a class.

I am having trouble getting the datasets connected to the SQL database, and using the stored connection string. I am thinking it is something like:

Imports System.Data
Imports System.Data.SqlClient
Public Class clsProcessNewsletters
Dim strSql As String = "SELECT * FROM Users"
Dim dtb As New DataTable

[Code] .....

First of all is this an appropriate approach? And if so, any pointers on cleaning up the code?

View 7 Replies

Refresh A Listbox In One Form From A Second Form?

Sep 30, 2010

this should be pretty simple but I can't find a solution. I spent a bunch of time, without luck, searching for an answer that makes sense (to me).
Here is the problem. I have an asp form in a frame (I know frames are considered evil, but this part is non-negotiable) This form has an asp:listbox that is tied to a SqlDataSource. A button on this form opens a second form that allows the user to add records to the SQL table that is bound to the SqlDataSource object (the source of the listbox in the first form) The thing is, that when the user closes the second form and returns to the first, the list box needs to be refreshed and I have no idea how to do that.

View 19 Replies

ADO.NET :: VWD 2010 And Linq To Sql: Can't Find A Query Model ?

Sep 19, 2010

I have added a linq to sql layer in my MVC 2 application.

This is the code I am using:

using (ProductPortalDataContext ctx = new ProductPortalDataContext())
var Title = from aps in ProductPortal.Models.AppSettingsView[code]...

It says to be unable to find a quey model for AppSettings view and then says "where not found".

Tried googling, nothing came up. Tried searching here(first two pages) and nothing that seemed relevant popped up.But the best of all, created a new ASP.NET applicatio, imported the model using Linq to SQL and it compiled!Ok, I tried adding a button and a label to the asp.net application just to see if it would work... guess what? It doesn't!Still the same error message and I have *NO* clue what's wrong with it!

View 8 Replies

VS 2010 - Page Property Values Query

Feb 20, 2015

I am working on a page whereby all the controls within the page get translated to another language.

This is handled within the master page prerender event and generally works fine.

However my page consists of a multiview control that is made up of 2 views. By default the INSERT formview is displayed so the user can enter form detials. This translates fine.

On clicking the save button the multiview active index is set to 1 and the EDIT formview displayed so as the user can update any of their details. This view does not get translated.

It would seem this is due to the controls not being available at this point in the page cycle or when this button event fires.

So i opted to do the translate process within the prerender event of the EDIT formview, and the method does have access to all the controls within this formview and runs after the master page prerender event. So all should be good.

However it seems that all th epage properties at this point in time are cleared. So the translation doesnt work. At the point of master page prerender i have verified they are populated with the values, but as soon as i hit the formview prerender all the page properties get cleared to nothing...

View 2 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved