Forms Data Controls :: Gridview Update Outside Of SqlDatasource?

Aug 26, 2010

Is it possible to use a SQLDataSource to populate a gridview but not use the SQLDataSource for Updating?

I wanted to add the update code in the Gridview_RowUpdating event since it is a complex update I need to do.

I get this message when i click the update button

Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.

View 4 Replies


Similar Messages:

Forms Data Controls :: Bulk Update/Delete Gridview Without Object/SQLDataSource?

Oct 26, 2010

I'm having a gridview in my aspx page with checkbox, User can select one or more than one record(s) at a time and clicks on delete button, Then i'm constructing an object of my DTO and adding all the checked row's Primary Key (DataKeyNames - GUID's in my case) to a serializable class and generating an XML and sending it as parameter to the Stored Procedure.

My Doubt is, can i bulk delete all the rows from database table those are present in my XML document??

If it works, I can do bulk update with XML only, i already did bulk insertion by generating an XML..

My Another Question is, Will it affect the performance? Each time when i construct an DTO object and adding it to the Generic List?

Which one is better, I mean ObjectDataSource or SQLDataSource or my XML method?

[code]....

View 3 Replies

DataSource Controls :: Update Records Of A Sqldatasource That Is Used For A GridView?

Dec 14, 2010

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?

View 5 Replies

Forms Data Controls :: How To Update Multiple Tables With A SQLDataSource

Mar 3, 2011

I have 2 tables

One:Table Name Rider With columns RiderID,LName,City

Two:Table Name Car With columns CarID,RiderID,Color

What I would like to be able to do is to allow the users to do an UPDATE on both tables.

Like if you crreated a SQLDataSource using just one table as it's source. You can use that SQLDataSource for a gridview.

Then in the gridview you can display all the data from the table but you can also EDIT all the data in the table through the gridview.

But if I create a SQLDataSource using 2 table joining them together with an INNER JOIN with a Primary Key in one table and a Foriegn Key in the other table. I can still use this SQLDataSource with a GridView to display the data but I can't EDIT the data through the gridview for the 2 tables.

Is there anyway to do this using a SQLDataSource and GridView?

OR is there another way to accomplish this?

View 3 Replies

Forms Data Controls :: Add Detailsview Old Values As A Sqldatasource Update Parameter?

Jan 9, 2010

I have a details view that is bound to a sqldatasource. The datasource has some extra parameters besides the updated data on the screen, they are;

[Code]....

I am want to take the old values of the details view from the detailsview1_itemupdating event and add them as a parameter to my sqldatasource.

[Code]....

So how can I then add this as a parameter to my sqldatasource?

View 2 Replies

Forms Data Controls :: Add Row Using SqlDataSOurce In Gridview?

Nov 25, 2010

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?

View 6 Replies

DataSource Controls :: Used Sqldatasource For Performing And Update Query But How To Update The Record On Click

Nov 9, 2010

Here is the sqldatasource config code: <asp:SqlDataSource ID="SqlDataSource1" runat="server"

View 1 Replies

Getting SQLDataSource Update Paramater From Gridview?

Mar 28, 2011

I am trying to get a parameter for my update from the gridview but it is an ID column that I do not want displayed. If I display the data in a boundfield it works fine but if I set the visibility to false the parameter is no longer sent to the update stored procedure. There does not appear to be a hiddenfield column that I can put into the gridview.I have tried to set the parameters through the code behind but I am not certain on how to access the data I want the following code does not work (It sets the parameter to nothing

Protected Sub grvFacilityDisciplineBillingRate_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles grvFacilityDisciplineBillingRate.RowUpdating
Dim row As GridViewRow = grvFacilityDisciplineBillingRate.Rows(e.RowIndex)[code]...

And this is the front end with the two ID columns displayed, which is not what I want

<asp:SqlDataSource ID="sqlDisciplineBillingRate" runat="server" DataSourceMode="DataSet" SelectCommandType="StoredProcedure" SelectCommand="SP_Facility_DisciplineBillingRates" UpdateCommandType="StoredProcedure" UpdateCommand="SP_DiscplineBillingRate_Update" ConnectionString="<%$ ConnectionStrings:Trustaff_ESig2 %>">[code]....

View 2 Replies

Forms Data Controls :: Textbox -> Value -> Gridview -> Sqldatasource?

Sep 7, 2010

I have textbox that searches for first or last name. Result show in gridview. But when add value in text box and push my button Find nothing happen. Here code:

aspx:

........
<asp:GridView runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="MobileNum"[code]....

View 1 Replies

Forms Data Controls :: Gridview Sorting Without SqlDataSource?

Feb 2, 2011

I want to sorting the gridview. I am using stored procedure currentlyHow can I put the sorting functions?

protected void populateItem()
{
string itemQuery = "usp_GetStockList";

[code]...

View 2 Replies

SQL Server :: Add Parameter To SqlDatasource With Update In GridView?

Jul 25, 2010

I have GridView1 and SqlDataSource1. I use EnableEditing to GridView1. This is Code of GridView

<
asp:GridView
ID="GridView1"
Width="100%"
runat="server"
AutoGenerateColumns="False"
BackColor="White"
BorderColor="#3366CC"
BorderStyle="None"
BorderWidth="1px"
CellPadding="4"
DataKeyNames="DoctorID"
DataSourceID="SqlDataSource1">
<RowStyle
BackColor="White"
ForeColor="#003399"
/>
<Columns>
<asp:BoundField
DataField="DoctorID"
HeaderText="DoctorID"
InsertVisible="False"
ReadOnly="True"
SortExpression="DoctorID"
/>
<asp:BoundField
DataField="DoctorName"
HeaderText="DoctorName"
SortExpression="DoctorName"
/>
<asp:BoundField
DataField="City"
HeaderText="City"
SortExpression="City"
/>
<asp:BoundField
DataField="Str"
HeaderText="Str"
SortExpression="Str"
/>
<asp:BoundField
DataField="StrRegion"
HeaderText="StrRegion"
SortExpression="StrRegion"
/>
<asp:BoundField
DataField="StringLevels"
HeaderText="StringLevels"
SortExpression="StringLevels"
/>
<asp:BoundField
DataField="Streat"
HeaderText="Streat"
SortExpression="Streat"
/>
<asp:BoundField
DataField="Email"
HeaderText="Email"
SortExpression="Email"
/>
<asp:BoundField
DataField="Mobile"
HeaderText="Mobile"
SortExpression="Mobile"
/>
<asp:BoundField
DataField="HomePhone"
HeaderText="HomePhone"
SortExpression="HomePhone"
/>
<asp:BoundField
DataField="ClinicPhone"
HeaderText="ClinicPhone"
SortExpression="ClinicPhone"
/>
<asp:BoundField
DataField="Fax"
HeaderText="Fax"
SortExpression="Fax"
/>
<asp:BoundField
DataField="address_details"
HeaderText="address_details"
SortExpression="address_details"
/>
<asp:BoundField
DataField="Expr1"
HeaderText="Expr1"
SortExpression="Expr1"
/>
<asp:BoundField
DataField="VisitPlaceStr"
HeaderText="VisitPlaceStr"
SortExpression="VisitPlaceStr"
/>
<asp:CommandField
ShowEditButton="True"
/>
</Columns>
<FooterStyle
BackColor="#99CCCC"
ForeColor="#003399"
/>............

View 1 Replies

Forms Data Controls :: Deleting A Record In Gridview Using A SQLDataSource?

Feb 6, 2010

I have a gridview and a SQLDataSource control. In my gridview I have 2 commandfields "Edit" and "Delete"

The "Edit" command field works as expected. Using the "Delete" command field I get the error below.

Server Error in '/DataControls' Application.

The DELETE statement conflicted with the REFERENCE constraint "FK__titleauth__au_id__0CBAE877". The conflict occurred in database "pubs", table "dbo.titleauthor", column 'au_id'. The statement has been terminated.

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: System.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK__titleauth__au_id__0CBAE877". The conflict occurred in database "pubs", table "dbo.titleauthor", column 'au_id'. The statement has been terminated.

Source Error:
[Code]....

Stack Trace:

[Code]....

View 1 Replies

Forms Data Controls :: Gridview.rowcommand - Sqldatasource.delete()

Oct 4, 2010

I have gridview+sqldatasource. In gridview i have button DELETE. But i want on click this button for some rows execute DELETE command other rows UPDATE. I did:

[Code]....

@index - DeleteParametrs in sqldatasource.

But DELETE works and DELETEVIRTUAL doesn't. Then i insert sourceMain.Delete() in rowcommand after sourceMain.DeleteCommand ... But it's doesn't help me.

View 9 Replies

Forms Data Controls :: Use SQLdatasource To Filter The Records For Each Gridview?

Oct 20, 2010

I have a database which holds the scores in the league for my local table tennis club. There are 3 divisions. On the admin page, I want the admin to be able to add teams and edit the scores. For each league, there is a seperate gridview. How can I use just 1 SQLdatasource to filter the records for each gridview if all the teams are in the same database with the division next to their name? I'm new to web development.

View 8 Replies

Forms Data Controls :: Manually Add Items To Gridview With Sqldatasource?

Mar 22, 2011

Can you add a row of data programatically and bind it to the gridview? If so, how?

I have a grid with 2 columns. One of these columns is a template that runs a function and delivers an output. Within that function I need to manually add data that is not present in the sqldatasource to the grid and use it when performing aggregate functions.

ColumnA - ColumnB
1 - MyFunction(1) - adds new row (1, B)and returns A to column B.
2 - MyFunction(2) - May return just A

Grid should look like
1 - A
1 - B
2 - A

Even though SQLDataSource only returns
1 - AB
2 - A

View 1 Replies

Forms Data Controls :: GridView, BoundField, SqlDataSource And DeleteParameters?

Oct 29, 2010

I I have a GridView attached to a SqlDataSource and all is working well. I also have and edit and delete icon attached to each record in the GridView, and again, all is working well.My problem is when I add a BoundField named 'statusCode', the delete stored procedure fails with:"Procedure or function 'up_delReference' expects parameter '@statusCode', which was not supplied."When I remove the BoundField named 'statusCode' from the GridView list, the delete works fine. I need to show the status in the GridView as the user can chose to see Avtive, Inavtive or Both records and they need to see the status when in Both.Here is the Code:

[Code]....

View 11 Replies

Forms Data Controls :: Get Data From A Database Using Sqldatasource And Bind It To A Gridview Using C#?

Mar 30, 2011

I am using Visual Web Developer (VWD)and I dragged in i.e created a Gridview. In the codebehind of the page, I will like to declare an sqldatasource and get data from a database using the sqldatasource and then bind the sqldatasource to the Gridview. PS: I know how to drag-in an sqldatasource and attach it to the gridview using VWD but this time, I want to do this declaratively in the codebehind.

View 3 Replies

Forms Data Controls :: Programmatically Create SQLDataSource And Bind To GRidView?

Jul 9, 2010

I have been trying some things and got stuck in problem.

I created a Gridview and SQLDataSource in designer and a on Button event executed the following Code

GridView1.DataSourceId="SQLDataSource";

It worked Fine and populated the Grid View.

But when i Decided to PRogramatically Create SQLDataSource ANd populate the Gridview by the following code

SqlDataSource fd = new SqlDataSource();
fd.ConnectionString = "<%$ ConnectionStrings:ConnectionString %>";
fd.SelectCommand="select * from [Department]";
GridView1.DataSourceID = "fd";

it didnt work. And Gave the following Error

The DataSourceID of '' must be the ID of a control of type IDataSource...

View 11 Replies

Forms Data Controls :: How To Edit And Delete In Gridview Without Sqldatasource Commands

Feb 19, 2010

how do i edit and delete in gridview without sqldatasource commands?

View 2 Replies

Forms Data Controls :: Gridview Updating Through Sqldatasource Doesnt Work?

Jan 1, 2010

this is the code

<%
@
Page
Language="VB"
AutoEventWireup="false"
CodeFile="Default.aspx.vb"
Inherits="_Default" %>

[Code]....

View 2 Replies

Forms Data Controls :: Batch Delete With SQLDataSource And Gridview Checkbox?

Mar 16, 2010

How do I modify this code to delete from SQLDataSource where the SQL command and parameters are specified in ASP?

[Code]....

View 7 Replies

How To Dynamically Add Update Parameter Value To Sqldatasource In GridView From RowCommand Event

Feb 4, 2010

I have two image buttons in a gridview, one to approve the opening of the record and one to approve the closing of the record. I have added a CommandName to each button (OpenApproved and CloseApproved) and in the grids rowcommand I would like to update the database with the Username of the person clicking the button, Username goes into either the OpenLeadApprover or CloseLeadApprover field depending on which button is pressed. The grid has a sqldatasource with an Update stored procedure which has three parameters, @WorkOrderIDWhat I have tried to do in the RoeCommand event is declare a variable for the sqldatasource and add the parameter value to it, then run the update command. Here is the code:

[Code]....

View 4 Replies

Forms Data Controls :: Can't Edit/delete With Gridview Using Dynamic Sqldatasource.selectcommand

Feb 2, 2010

With asp 2.0 and vwd 2005, I have a page with a radiobuttonlist, textbox and gridview with edit/delete. Using the radiobuttonlist, the user selects a search type and then enters the criteria in the text box. the click event of a submit button checks the rbl.selectedindex and chooses a sqldatasource.selectcommand with the where clause getting its criteria from the textbox. The gridview loads the data, but the edit/delete are not working. Code and relevant markup is below

[Code]....

[Code]....

[Code]....

View 3 Replies

Forms Data Controls :: GridView + SqlDataSource Selected Items Disappear On Edit?

Mar 12, 2010

[Code]....

I am trying to put the select command in code behind:

sdsAdd.SelectCommand = String.Format("SELECT Classes.ClassId, Committed, CallNumber, SubjectArea, CourseNumber, SectionNumber, GradingBasis, NumberOfUnits, NetId FROM Classes INNER JOIN EnrollmentAdjustmentClasses ON EnrollmentAdjustmentClasses.ClassId=Classes.ClassId
WHERE AllFormsId='4' AND SectionId='1' AND NetId=@NetId AND Committed='True' AND EnrollmentAdjustmentClasses.FormId={0}", Request.QueryString["FormId"].ToInteger32());
gvAdd.DataBind();

When I do that, then click edit to edit the selected item, the item disappears from my gvadd. What am I doing wrong?

View 3 Replies

Forms Data Controls :: Gridview Columns Change After New Sqldatasource Changed In Code?

Feb 14, 2010

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?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved