BINDing an ASP.NET 2.0 FormView - CheckBox or RadioButton to Oracle CHAR(1) Y/N - asp.net-2.0

Oracle 9i has not BOOLEAN data type. CheckBoxes in ASP.NET are BOOLEAN controls are they not?
So using a CHAR(1) column with Y or N values in the Oracle table, how do I bind to a CheckBox or CheckBoxList or RadioButton or RadioButtonList control on an ASP.NET 2.0 web form?
I'm using VB, 'specially since I'm a noobie.

I would set the value to 1 or 0 and have an int datatype

Related

Can any one tell how to copy data of GridView into DataTable in ASP.NET in C#

in my project I need to copy all the rows of GridView into a DataTable. Can any one tell this can be done in C# ASP.NET
You can use its DataSource property
DataTable myDataTable = myGridView.DataSource as DataTable;

asp.net how to store more than 2 columns from database in checkboxlist

When I connect some data source to checkboxlist I can define attributes:
DataTextField="column1" DataValueField="column2"
Then I can use in cs file .Text and .Value Properties respectively.
Columns 1 and 2 are taken from some sql select instruction.
Is there any way to store more than that 2 columns from database.
Something like CustomDataField="column3" ?
Thanks
As per the builtin properies of DropDownList there is no way to store more than 2 columns from database.The properties like DataTextField,DataValueField of DDl are defined in ListControl class of System.Web.dll.

DropDownList Substring to Populate Textbox for Stored Procedure

My Asp.net page has multiple textboxes and DropDownLists that populate from a selection in the Gridview. My problem is multiple, I have a keyfield in the gridview that is a uniqueidentifier used to insert, update, and delete records from my database. I do not want theis column to be seen, I have used a css
.hideCol
{
display: none;
}
But it isn't working, I also tried setting Visible = "False" and it will not populate the textboxes. I need to find out how to hide that column so the user doesn't see it.
My new problem is my DropDownLists consist of a sql query from one table and concatenating multiple columns.
SELECT [Column1] + ' | ' + [Column2]
FROM [Table1]
ORDER BY [Column2]
So my result looks like this is the DropDown:
123456 | Name
When I try and populate my DropDownLists and Textboxes from the selected row of my gridview I get an error on the DropDownList because it is not recognized as a value.
123456 is what is in the database I need it to populate based on those numbers but display in the format above? Does this make sense? any suggestions?
UPDATE:
AllowPaging="True" CellPadding="4" CssClass="td3" ForeColor="#333333">

Using parameters to configure the table name in an SqlDataSource SelectCommand

I have an ASP.NET 3.5 web form with a DropDownList bound to a table of company names in a database. I also have a data bound GridView which I would like to update with data from the database depending on the company name selected in the DropDownList, so that the SelectCommand for the GridView's SqlDataSource is:
SELECT Registration, Telephone, Profile FROM {CompanyName}_VehicleData
Where {CompanyName} is whatever is selected in the DropDownList. I've used the Command and Parameter Editor to create a ControlParameter pointing to the SelectedValue of the DropDownList, but I don't know how to write the SelectCommand query to concatenate the parameter to '_VehicleData'. Any thoughts.
If you are using a sqldatasource you could set the select command in the code behind.
<sqldatasource>.SelectCommand = "select registration, telephone, profile " & _
"from " & <dropdown>.selectedvalue & "_VehicleData"
<sqldatasource>.SelectType = SqlDataSourceCommandType.Text
#Colin: You said that the solution is writing a stored procedure that evaluates whether the concatenated value (DropDown.SelectedValue + "_VehicleData") maps to a real table using the INFORMATION_SCHEMA.TABLES view before injecting it into a SQL command. Can you please give a code snippet for the stored proc?

rowindex on gridview control - VS 2008

With a gridview control bound to a sql data source, i want to display a column named ID. The ID should display the row number for each row. How would I go about binding this to rowindex instead of the ID column from the database?
For that I would use the ROW_NUMBER() function which is new in SQL Server 2005.
This function returns rownumber in the recordset that is being returned.
There is an excellent post by ScottGu.
HTH,
Valve.

Resources