.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

You have specified that your delete command compares all values on SqlDataSource 'SqlDataSource1',

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
 
hi.am getting the following error .... i have a grid view with a command field ADD(i e INSERT)..... EDIT and DELETE.....edit button works fine but when i click on DELETE its throwing the following errorYou have specified that your delete command compares all values on SqlDataSource 'SqlDataSource1', but the dictionary passed in for values is empty.  Pass in a valid dictionary for delete or change your mode to OverwriteChanges.so can any one help me in this regard...


View Complete Post


More Related Resource Links

wss2.0 update/delete/hide lookup column that does not display any values

  

Hi All,

I have a document library that contains a Category column that is a lookup field. This is a default column that is a required field when uploading documents to the document library. The Category column is empty and I am unable to amend, hide, make it not required or delete it.

I have gone to Modify settings and columns -> clicked on the Category field to edit, but there is no option to amend the content or delete it. I am only able to amend the Column name and Description.

Since then, I have amended the column name to eg. Category1 and created a new Category field as a lookup and linked it to the correct list.

The problem I am facing now, is that I cannot hide, delete or make the Category1 (old Category) field NOT required. Either I would like to update the original field to display the correct values or alternately hide, delete or make the column not required.

Please help.


How to get nodes based on some values, update other element or delete that whole object

  

Hi,

This is my xml string.

<xml version="1.0" encoding="utf-16">
<objA>
    <x> test value 1 </x>
    <y> test value 2</y>

    <objB>
        <x> test value 3</x>
        <y> test value 4</y>

            <objA>
                <x> test value 5</x>
                <y> test value 6 </y>
            </objA>

            <objA>
                <x> test value 7</x>
                <y> test value 8 </y>

                <objB>
                    <x> test value 9</x>
                    <y> test value 6</y>
                </objB>

            </objA>

    </objB>

</objA>


</xml>


 

 

I have a big xml same as above containing a deep hierarchy.

Now, I am looking to do two things.

1. I want to find a particular node/obj by checking <x> element value. so I want to get node ofwhich <x> value is "test value 3" and for that object, I want to update <y> value to "Some New Value".

2. I want to find all the nodes/objects by checking <y> element value is "test value 6" OR "test value 8" OR "test value

How to disable delete command for certain activities inside the composite activity

  

Hi

I had build up a composite activity, this composite activity basically contains a few activities, some of the activities are not allowed to delete. Is there a way to disable the delete command using WF APIs, instead of hooking up the keydown and context menu event for those activities?

thanks 


gridview.rowcommand + sqldatasource.delete()

  

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:

protected void GridMain_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
     if (DataBinder.Eval(e.Row.DataItem, "DelFlag").ToString() == "True")
            {
               btnDelete.CommandName = "Delete";
            }
            else
            {
               btnDelete.CommandName = "DeleteVirtual";
            }
   }
}

protected void GridMain_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
           sourceMain.DeleteCommand = "DELETE FROM [Main] WHERE 
                                                        [index]=@index";
        }
        else if (e.CommandName == "DeleteVirtual")
        {
            sourceMain.DeleteCommand = "UPDATE [Main] SET DelFlag = 'True' WHERE  
                                                        [index]=@index";
        }
    }
@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 m

XML with PrimaryKey values to delete rows in database table at a time

  

 Hi,

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??

Can anyone please help me out clarifying my doubts and also XML Delete Query..

 

My XML will be like this

 

<root>

<Customer>

<CustomerID>GUID1</CustomerID>

<CustomerID>GUID2</CustomerID>

<CustomerID>GUID3</CustomerID>

 ...

 ...

</Customer>

</root> 

Will bulk delete happen in the above case?

Thanks,

PAvan


Assign values to SqlDataSource Parameter from drop down list in InsertItemTemplate

  

Good Afternoon;

I have a Detailsview grid with an SqlDatasource, this DVG is only going to be used to insert records. The primary purpose of the DS is to populate a DDL control in the insertItem Template that I created my code is this:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:testdbConnectionString %>"
            InsertCommand="INSERT INTO tblSelections(sTesterID, sTestDate) VALUES (@TesterID, @TestDate)"
            OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT tName, tExternalID FROM tblTesters">
            <InsertParameters>
                <asp:Parameter Name="TesterID" />
                <asp:Parameter Name="TestDate" />
            </InsertParameters>
        </asp:SqlDataSource>


The DDL control populates correctly, but when I try to modify the  INSERTCommand property in my DS, I try to assign the value to my parameters "TesterID" and "TesterDate" but the only options for controls to pick from, is the DGV but not the DDL in it. I assume it has to do with the InsertItem template but even if I reset it I still cannot pick

passing values in delete confirmation message box

  

Hi All,


I have a delete confirmation message box. I want to pass some values to it.
My code is as below:
In aspx file :
<script language="javascript" type="text/javascript">

        function confirm_delete() {
                  
            if (confirm("Are you sure you want to Delete?) == true)
                return true;
            else
                return false;

        }

In Page Load:

     btnDelete.OnClientClick = "return confirm_delete();";
So when ever User clicks on delete,a message box pops up.
Now In the same message box I want to show two more values that are in my Session of the same page.
Like for example : I want the message to be popped as " Are you sure you want to delete Value :001 Description : ABCD ? "
The Value and Description are being stored in a session like Se

c# sql delete command

  

Hey all.

Just wondering could anyone tell me how to do a c# delete command.

So far i have

cmd.CommandText = "DELETE FROM SavedSignInsNew WHERE LastName = " +  StudentLastName.Text + "AND FirstName = " + StudentFirstName.Text +";";

which is not working.

Thanks for help

 


Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

How to Pass Values Between Web Pages ASP.NET

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

How to Pass Values Between ASP.NET Web Pages

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

  
Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?



Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.



For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

jquery autocomplete multiple values

  

i got some samples and i did autocomplete using jquery , its working well for single input values

but i need to pass multiples values after one by one in the textbox. Is it possible to pass multiple

values in the textbox for autocomplete in jquery in asp.net?

 


Row command working on all rows not selected one?

  

Hi,

I have this code that hides a column in a gridview.  (The column houses another nested gridview).


    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
            Else
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub


The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


Thanks.


JQGrid Loading deleted values

  

Hi,

This is quite strange. here is the issue:

Some Info:

1. I'm using a multi-select jqgrid.

2. I have my own delete button to delete multiple orders

The problem:

When i press the delete button on the pager of my jqgrid, the records are deleted from the database but JqGrid shows some records (4-5). On refreshing the grid, correct numbers of records are shown.


Here is the code:


function delorder() {
        var amg = $("#horder").getGridParam('selarrrow');
        var cont = amg.length;
        if (amg.length > 0) {

Print command

  

 

Is there a way of setting up a print area for a part of my webpage, I only want to print a certain part of the page, when I select print at the moment it will print the whole page and the layout is rubbish!!
 
Thanks
 
Richard

How to cast integer values as an array of enum values?

  

Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object

 

However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend