Gridview need help

Sorry for posting this in the wrong forum - but cant find a forum for Web.UI controls. If someone knows of a good forum for asp.net web ui please post as it.

I have a GridView component in which I have defined a "delete" configured CommandField. When selected, the DeleteCommand of the configured datasource calls a stored procedure to delete the selected record.

However the deletecommand is firing twice. There are no pre/post delete events defined for the GridView or the DataSource.

When the ButtonType for the "delete" configured CommandField in the GridView is set to Image the DeleteCommand always fires twice.

When the ButtonType for the "delete" configured CommandField in the GridView is set to Button the DeleteCommand properly fires once.

Anyone have any insight



Answer this question

Gridview need help

  • Dewa

    DataGridViewRow newRow = new DataGridViewRow();
    newRow.CreateCells(dataGridView);
    dataGridView.Rows.Add(newRow);

    Works if you don't use databinding.

  • RobinHuan

    I have the same problem, i have spending 5 days trying to fix it with no luck, please Help , i know there is smart develper out there how will solve it with in 3 secondse so plesae help us

    Thanks



  • zul_slider

    In my application i am using Dotnet Gridview control.

    To fetch the records from sql db and display the values in gridview.(Assume in gridview contains 5 rows)

    Below the gridview control i have one button control.

    Question is:

    1.When i click the button i want to add one more empty row with textbox controls in gridview.

    The row should be added below the 5th row without affecting the Previous rows.



  • VBNET_Fanatico

    Yes a Web.UI controls forum would be nice. I am having problems with a gridview GridView1_RowDeleting routine throwing a

    Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

    I am trying to run a msgbox during the event which works great on VWD running on localhost. After I upload it to the server it throws the exception. No wonder I drink too much.

    If someone could point us to a good forum for these problems it would be much appreciated.

    James



  • John P. Grieb

    Rather than using a MessageBox I create a Literal control with scripted text to show error mesages. Here's an example in C#:

    Literal warning = new Literal();
    warning.Text = "<srcipt>alert('Place error message here.');</script>";
    this.Controls.Add(warning);

    ...works like a charm. If I know the error may be thrown a few times I'll give the Literal control an Id and say this.Controls.Remove("SomeId"); before I create the new control just so the page isn't full of script that's only used once.

  • J-BRIM

    Hi!

    I just gave a simple scenario like this a shot, and it's not firing twice on my box, only the once as I would expect. I'm using a RowCommand. Are you sure you don't have RowCommand defined as an event, as well as RowDeleting or RowDeleted

    The best place for asking ASP.NET questions is on the ASP.NET community site, and in the forums there. Check out http://www.asp.net/welcome.aspx tabindex=1&tabid=39.

    HTH,

    PEte



  • Gridview need help