I am going to use DetailsView control for the first time and before using it I thought I would like ask this question. Instead of using the SqlDataSource Object/Class Can i have my class to most of the functionality?In short I donot want to use the in build Sql Data Source control rather would prefer to write my own. Is it possible (I know it must be!) to write the custom SqlDataSource class.
As apart of my learning, I want to learn more about the data controls in asp.net.I have used the gridview in situations where it is specifically bound to an sql data source and handles updates and deletes really easily, but I have thought of something that I want to model, however am not sure which control is best to use.
The situation I have thought about is a bank statement. Most bank statements have the transaction name/details in one column, then two columns for debit and credit and then a third column for a running balance.I have read about using a footer row for insertion records, but I imagine you would not have the same about of columns in a footer (insertion) row. I.e. A transaction would not have a debit and a credit entry field, only an entry field for the amount and a dropdown for debit/credit.
Would the gridview be the best control to model this situation on? Or is there another control that would be best used? The control won't be talking to a sql datasource, but probably a datatable in the codebehind.
I need a complete code reference for Detailsview and Formview using the code only:OnRowCreatedOnRowEditingOnRowUpdatingOnRowDeletingOnRowCancelingEditOnPageIndexChanged OnPageIndexChanging OnSorting OnRowDataBound
In an asp.net 3.5 web app, I have a page with the following markup/code (this is the brief version, but I believe I got all the relevant info).
The form contains 2 different record types, accessed using the paging controls, depending on the ParentSR field; a parent SR will be something like '1234' while its sub-record will be something like '1234.1'. There are only a few differences in the fields used between the 2 different record types and that is why they are stored in the same table. However, the activity depends on the record type. When browsing from the parent record to the sub-record, the itemtemplate loads fine (notice in the formview's datasource query, that the sractivity_id field is being pulled along with the subquery value). But when going to edit the record, the page throws an error:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentOutOfRangeException: 'ddlActivity' has a SelectedValue which is invalid because it does not exist in the list of items.
If i click 'back' and retry, it may take 3 attempts, but then the edittemplate will load just fine. I should also point out that this error does not always occur. I've been trying to figure this out for a couple months and it is driving me nuts, mainly due to the fact that I can't reproduce the error in development--it seems to only occurr in production. Anyone with any thoughts on what is going on?
a FormView that is linked to SqlDataSource1a Repeater control (inside the formview) that is linked to SqlDataSource2Thus representing a simple "1 to many" or "parent/child" relationship in the database!qlDataSource1 is simple in that it just retrieves a straight set of records from a table and they are displayed back in the FormView (nothing special happening there).SqlDataSource2 has parameters that filter the contents of the repeater based on the record that is shown in the Formview. This would normally be simple enough to set up by setting the parameter to the formview.selectedvalue property.HOWEVER - THE PROBLEM ARISES...The formview has multiple DataKeyNames because the table that the SqlDataSource1 links to has a compound key. So to filter the Repeater correctlySqlDataSource2 needs to map 3 parameters to 3 data key values in the formview.Any ideas how to do this?I've tried setting the SqlDataSource2 parameters to:
Is there an equivalent of the GridView.RowDataBound event for the DetailView and FormView controls in ASP.NET 3.5?I need to manipulate data after Selecting it from my database, but before it gets presented to the user. I've read the documentation but I think I've missed something because I can only find FormView.DataBound which is called after the entire control has been data bound. Something like an ItemDataBound event would be what I need....?!?
am in commercial development for few months only,the team leader is not using gridview, detailsview, formview, repeater, datalist.we alwyas write our own looping to dislpay the data even it is read only.He said : we do this for better performance.and I am always thinking, so why microsoft create them???I checked other questions and articles, and I am still confused.
i couldnt find a specific answer to this question, i am relatively new to .net :)
i have a gridview that is displaying data from a sqldatasource in my page_load event. i need to loop through the records and update each value of a particular column BEFORE being set into the GridView.
i have tried converting to a data set and looping through updating the values, however it seems that one i initially run my query the values get set right into the GridView and i can't update them after that.
Do I need to add one of the GridView functions like Databound and do the loop in there?
I want to create a generic page which contains a gridview and sqldatasource. I want to put these two controls on .aspx (C#) page but bind them at runtime. It should have selectcommand, updatecommand, deletecommand and insertcommand. Stored procedures are created for that. Help is needed to make it. .
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 am not able to figure out why I am getting the null error at SqlDataSource10.Insert(); I tried running through break points and i checked the Insert statement and it has all the required values .. but I get error saying it cannot insert null into NrNarrativeDays. I am working off a sample at this link..
For some reason the select parameter pAddId is getting set to null and get the following error when the content page is loaded If I hard code the value it works RA-01036: illegal variable name/number Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Oracle.DataAccess.Client.OracleException: ORA-01036: illegal variable name/number
What ive been using now is getting datas in code-behind, passing datasource into a Session, re-binds it to a gridview whenever there's paging/sorting needed. What i want to know is what is better if its performance we are talking about?
Is it datasource into a session Or SqlDataSource for which I know whenever paging/sorting needed is that sqldatasource opens up a DB connection to get the datas again?
I am trying to use a DropDownList in a DetailsView for the ItemTemplate, InsertItemTemplate, and EditItemTemplate. I must bind this DropDownList to a SQL-Server support table using a function that returns a DataTable. I am not allowed to use a SQLDataSource in my backwards IT department. So, not only do I need to load the DropDownList, I also need to make the SelectedValue equal to the current record that I am viewing, editing.
I am using a stored procedure for a sqldatasource to update a formview. I believe that I am passing the Obligation_Status value correctly to the stored procedure but the oblgation status field is always updated AS NULL in the database. Does anyone know what I am doing wrong?
I would like to move all of this to codebehind so it's easier to work with programmatically. For instance the PracticeId is a selection from a dropdownlist that is populated from another table... i need to determine what the current selection is first so i can display the record / bind properly.