VS 2008 Change Data In Gridview When Retrieved With SQLDatasource?
Mar 10, 2010
When the data is retrieved through a stored procedure using the SQLDatasource control that is binded to a gridview control, I want to change some data that is in some of the columns. Can i do this in one of the events either in the gridview or data control? I know you can do some formatting on the aspx page side such as dates, etc. but was wondering if I can do it on the vb code side?
I have a gridview that loads with a new datasource on button click event. On the gridview (which is located in a table columm incidentally) are 2 columns, a descriptor and a checkbox. The problem is that after postback, the column widths change, the checkbox column expands and the other column contracts. Is there a way to keep the gridview column sizes the same after postback?
I typically don't use the sqldatasource control but trying it out and can't seem to get the delete function working. It doesn't seem to be passing a parameter to my stored procedure. The error I get is: Procedure or function 'sp_DeleteCraigsListEntry' expects parameter '@craigslist_search_id', which was not supplied. Any thoughts?
a simple way to filter SQL data when it is retrieved by a GridView control?
Among the various applications I need to create are selecting records based on user inputed criteria (via a DropDownList), and excluding records that have null values (which I need to allow in my database) in certain columns.
In one grid there is only one column and entries are 100+, all entries are hyperlink entries, but the gridview does not look nice with one column and 100+entries, is there any way I can split that entries in 3-4 coluns to look even.
On my web pages I display the data as mm/dd/yyyy and that is how the user will enter the dates as well. But when I pass the textbox control that has the date in it as a parameter to the SQLDataSource control, I need it to be sent in the YYYY-MM-DD format for the AS400. Is there a way it can be changed in between?
I have a series of dropdownlists on webform in ASP 4.0. The first drop down is filled upon load, and then when a user selects a value from that list, it populates the second dropdown. To accomplish this, I have a SQLdatasource with a parametersource of the first drop-down list control. This works great, except when a user changes their selection from the first drop down. It performs the query, but then adds the list of items to the ones that were already there from the previous selection, instead of replacing it with the new data. Here is the code:
Do I need to do something on selectedindexchanged to somehow "clear out" the previous datasource? I can't find anything about this online, although one person seemed to suggest it was related to using a master page. (which I am using).
The dataGrid view is being populated. The Autogeneratedcolumns is set to false. How do I change the colour of a cell of a row depending on the text? i.e. Row 2, column 5 says "Failed". I would like to change the colour of that cell to be red.
I have a gridview that I am loading from a stored procedure. I need to be able to hide certain columns and change the column names. Since it is loading with stored procedure the columns aren't listed in the gridview->edit columns properties.
I have a datasource that is connected to a stored procedure and I need to do a postback on the web page but do not want the sqldatasource to do a databind. What I am doing is when I change a dropdown box to fill in some textboxes with specific dates, I do this on a postback so the textboxes are filled in with the dates. But the SQLDatasource control data binds again and shows new results in my gridview.
Is there any way to prevent this so I can just postback to fill in the textboxes?
I have a list of numbers I need to submit one at a time to a stored procedure to add to a table. I don't know any other way around this. The database for this is an AS400 so it's not like using mssql server. I have a connection string and use the SQLDatasource controls to select data because I can select a stored procedure with it to call. Now I need to do an update and if it was just one time of submitting information I would do it the same way. But I need to submit each number till I do them all. How can I do this? Do I still use a sqldatasource control and set the value to be pulled from like a session var and just loop through setting the session and then sqlds.databind over and over? I added a DBML but can't do that with the as400 stored procedures as far as adding them like I do mssql.
i designed a gridview to update, delete the records using sqldatasource, (there is no code in my aspx.cs file) but i dont know how to add the new row the gridview. so that if the table is empty then i cant add / update / delete the data.
how to Add new record on gridview using SQLDatasource without any code behind code?
I have a sqldatasource control that I want to get the field values from as it is selecting. Is there any way to do this in the dsControl_Selecting event for each record without binding it to any control or formview? I would like to call dsControl.DataBind and retrieve the field values.
I use the sqldatasource control a lot with stored procedures. But this time I'm using some code I found online where I am defining the new sqldatasource in the code and using it. You can see this below. I am getting a NullReferenceException on the first SelectParameters line and not sure why. Do I need to add the parameters different?
Code: Dim SqlDataSource As New System.Web.UI.WebControls.SqlDataSource() SqlDataSource.ConnectionString = ConnectionString SqlDataSource.SelectCommand = "MySprocName" SqlDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure SqlDataSource.SelectParameters("Distance").DefaultValue = 25 SqlDataSource.SelectParameters("ZipCode").DefaultValue = "31410" Dim arg As New DataSourceSelectArguments() Dim dv As System.Data.DataView = DirectCast(SqlDataSource.[Select](arg), System.Data.DataView)
in my asp.net+access web code in vb. There is three labels named (tata.text,tvs.text,msu.text) is there any option on clicking on the label named tata.text the data pertaining to tata be displayed in a gridview in another page or a popup display in same page.
Up until now I only needed one connection string since I had only one database but this has changed since I want some users to connect to database A and others to database B What would be the correct way to go about it?
I'm using Visual Web Developer 2010 Express. This is my first attempt at creating a .NET page. I have a Gridview on a page that displays the results of a GridQuery. This works. I have a checkbox control(cb_Filter) on the same page that if checked, should add to the where clause of the GridQuery, (where Column5 IS NULL). How do I check the state of the check box so it will run the query with or without the "filter".