DataSource Controls :: Control Value In A Datacontrol Inobject Datasource Events?
Feb 23, 2011
I've a listview with checkbox control in it and datasource as object data source.
I'm updating the values in listview using update method in object data source, problem is I'm not able to pass the value of checkbox checked in the update event as parameter.
I've written this code to display a group of events when the value is 12/19/2010. This means each day I need to change the "default value" to the current date to display the events of the day. I would like to make this such that the change occurs automatically, that is, on 12/20/2010, I'd like to see just the events for 12/20/2010.
I would like to create a webform in asp.net that allows you add events to a overall application, anyone then can go search that event by a specific date and if that event falls under that recurrence day you will see it. This would be similar to Outlook where you can say it recurs every Monday, Tuesday, Wednesday,... or every third Monday, ...Specifc day of the month, etc. I have created the webform but now I have the problem of how the database works. I have been reading for the past couple days about this but I cannot figure this out. I found some posts that say you can create a seperate table aside from your main table that holds the eventid and the dates of the recurrenecs. The problem is this table could amount to thousands of lines from just a few events input. My question is, is there a formula out there that can do this without creating a crazy big recurrence table? .... If not, how many lines can a MS SQL database hold before it has performance problems?
Here's a link to another forum I found with my same question but I do not understand the answer:
As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.
public IEnumerable<Customer> GetCustomers() { Table<Customer> custObject = context.Customers; IEnumerable<Customer> filteredCustList = from customer in custObject select customer; filteredCustList; } GridView2.DataSource = utilLinqClass.GetCustomers(); GridView2.DataBind();
(no errors at build time or at compile time) Error I am getting is: An attempt to attach an auto-named database for file App_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
i have problem white Object datasource. i have a multi-tier Application that include common layer ,DAL Layer,business logic and persantation layerwhen i add a object datasource to my page, it bring me only common layer classes . but i want use bisuiness layer classes what do i do ?
i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:
string path = Server.MapPath("~/uploadaccess/Production.mdb"); string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";"; and also OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";"); and tried this OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));
and this is the error i am getting:
Operator '&' cannot be applied to operands of type 'string' and 'string'
I am storing a custom "Organisation" object as a session variable. One of the properties of the Organisation object is "OrganisationID" (integer). I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:
[Code]....
However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")? I have tried this, which does not seem to work: <asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />
i have two sqldatasource controls. one i use to display data in textbox's ,filter'd by a select parameter in page behind code. Once checked, i want to copy this data to the other datasource ,by selecting checkbox.Then display this data in detailsview control.
At present the two datasource controls declared , render data to the page simultaneously during pageload. I want to first check data in textbox's from first source, before second datasource is rendered to screen. note, both are filtered by a page variable. i wish to leave the textbox datasource control in situ, as other controls and code depend on it.The other detailsview datasource is my problem?
im explaining this base on a test page that i have hosted as i was trying to track down my problem, i have a hosted page which i have hosted on the internet on a hosting service provider. the page has a normal gridview that is linked to a SqlDataSource. and theSqlDataSource has sql statements for selecting data, updating and deleting. They all work fine locally and even if i host them locally through IIS. but on the hosting service they down work. only the select work, which means i can view my data on the gridview but i cant manipulate it, delete and updating dont wanna work, they dont do anything. and the worse part is that im not even getting an error from them, on the grid i have enabled the autogenerate edit button and the delete, how can i make the update and delete work, or what is it that makes them not to work. the code for my test page is below
Scenario: I am creating a custom gridview control which has a custom CheckBoxTemplateField column (deriving from TemplateField class). This template field column has custom Checkboxheadertemplate (implementing ITemplate) and CheckboxItemTemplate (also implementing ITemplate). In InstantiateIn method of both templates (header as well as Item template), I am adding a checkbox control which has Autopostback = true.
My requirement is: I want to mark all the values in the binding column of datasource if checkbox in headertemplate is checked. I dont want to mark only rows visible on grid. I WANT TO MARK ALL ROWS IN DATASOURCE. I want to do this in _CheckedChanged event of checkbox in header template.
Problem I am facing: When I check/uncheck the checkbox in header, it postbacks. so in OnCheckedChanged event, gridview's datasource is null. Secondly, in any event of gridview, I could access only those rows of datasource for which corresponding rows are visible in gridview through Gridviewrow.DataItem property. But I want to set it for all rows in datasource.
I have a website which displays news information. It displays the titles at the default (home) page and when click it shows the full story.
I use object datasource to load the news titles.
Now, sometimes the database server lose its connection or changes to the database and it affects the whole website because error is reported at the Application level. I would like the Home page to still show but the section where the news titles usually appears will now show an error message that the database is down (Refer below my part of my code).
How can I achieve that?? I tried to do that at the page_error level but it displays nothing. I don't want to pass the error to application level, I want to handle at datasource load/binding level so that it display this error message at the news section and other home website information can still be shown.
If I make changes to a table or view in the datacontent (dbml), is there any way to refresh the fields in the dbml without deleting the datasource and inserting it back again?
I have page that has a datasource. The datasource executes a stored procedure and returns results. If the result is NULL, I'd like to forward the user to an error page. How would I accomplish this with ASP.NET and C#?
I have a SQL Datasource populating a Drop Down List with Company Names. The Select Statement the Datasource uses selects Company ID and Company Name.When a company is selected from the list, there is a button on the page to continue processing with the selected company. On the press of the button, I want to set a session variable for the Company ID of the Company selected. This Company ID is obviously held in the Datasouce. Any idea how I get at the Company ID.My code will look like the following:Session.AddsessCompanyID", ????????????)where ?????????? represents the source of the Company ID.
This is the first time I have been working on databases and I am trying to insert data using an object datasource but no data is being inserted and no exception is thrown. I'm not sure where I am going to wrong. I am putting user data into session variables and inserting the session variables into the dataacess class layer and have a try and exception but nothing being thrown. Any help would be really appreciated because I don't know even where to start looking with this or how I can get the error to be thrown. Please see some of my code below to give an idea of what I am doing
Object Access Class public void InsertCarPolicyHolder(PolicyHolderClass ph, CarInsuranceOptions options) {
I have a Public Sub listed in a class file that I am using to store Select, Update,etc...methods for an Object Datasource. When I attempt to configure the datasource, the Class appears as a business object, but the sub within the class is not available for method selection. (It does not appear in drop down list in wizard.)
The sub exists, so where is a good place for me to start looking for a fix? I have part of the class file listed below:
I am developing a website of online examination and i want to know how to display question of my paper along with its Answer options as radio button list. And if i use any data control then how to add radiobutton list n bind that list thru database
I have a masterpage and 1 childpage. In master page there is a listbox to present a data when a child page button is clicked. Listbox name is x1 for example.
When i am in childpage's button click event: i do not see that x1 named listbox due to namespace i guess.
For example masterpage name is masterpage1. When we are in childpage in button click event.
To try masterpage1 objecttemp = new masterpage1()
button1_Click() (child pages button click event)
masterpage.x1.items.add("button 1 clicked"); it is not being able to reachable too.
Also i encountered another issue related to that. When in masterpage for example masterpages click event. (its a login panel and when user clicks login, i had wanted to add a text information to listbox). In child pages when user clicks to login button which belongs masterpage top panel. It does not seem like working. It may be related to asp page master child life cycle and i do not know good. I wanted to able to add a string to listbox that belongs and come from masterpage in child page. Is there any way to use a datacontrol in childpage that belongs to masterpage.
I need to populate a listbox with queries from 2 sql tables, but I can only see how to populate it with 1 datasource.
Do I need to do some hand coding? If so, where should I put it?
I'd also like to add some text items to the listbox so I could say populate the listbox with a query, plus an "other" option, so that if "other" is selected, a textbox will appear that will let the user specify a new item.
I am really having a hard time trying to write something from scratch I created a 'Person' Class.Public Class Person
Private _FirstName As String = "" Private _LastName As String = "" Private _Age As Integer = 0 Public Sub New(ByVal FirstName As String, ByVal LastName As String, ByVal Age As Integer) FirstName = FirstName _LastName = LastName _Age = Age [code]...