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?
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.
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.
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 : da.Fill(ds)
The table in Database1 that I'm trying to access is called Ray Rover Activation.
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.
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.....
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?
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)
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.
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.
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
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.
Code: Private Sub FillSnAvailList() Dim strconnect1 As String = ("Data Source=MyDataSource") Dim con1 As New SqlConnection(strconnect1) con1.Open() Dim cmd1 As New SqlCommand("SELECT [sPartNum], [SerialNum] FROM [V_MaxSerialNum] WHERE ([sPartNum] = @sPartNum)", con1)
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?
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
I have this code which takes a value from a dropdown control as a parameter.
[Code]....
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:
'item1','item2','item4'
For the above example I would need all the the records returned when the field action_ref contains either item1 or item2 or item3.
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
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.
Dim cmd As New SqlCommand cmd.Connection = New SqlConnection(<connectionString here>) cmd.Connection.Open() 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 cmd.Connection.Close()
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?
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?
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:
Code: 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?
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.
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!
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...