CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 10/19/2005 2:43:35 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 31 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
CrypticDust
Asp.Net User
Is the gridview update/cancel command broken is vs2005 beta 2?10/19/2005 2:43:35 PM

0/0

Heres the scoop:

I am writing a basic "entry" page for a database using the gridview, I set the gridviews properties to autogenerate edit/delete buttons.
When the page initalizes I create a blank dataset and bind that dataset to the grid.
After the dataset is bound I can click on edit/delete and it fires the appropriate command:

Edit fires RowEditing
Delete fires RowDeleting

However, after the row is then enabled the update/cancel commands DO NOT fire the right appropriate command.

Update fires RowEditing
Cancel fires RowDeleting

Below is a basic program that I whipped up to show an example:
--ASPX--
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<title>Untitled Page</title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<b>Car Name:</b><br />
<asp:TextBox ID="carNewName" runat="server" Visible="true" TextMode="singleLine"></asp:TextBox><br />

<b>Car Description:</b><br />

<asp:TextBox ID="carNewDesc" runat="server" Visible="true" TextMode="singleLine"></asp:TextBox><br />

<b>Car Details:</b><br />
<asp:GridView ID="grdCarNew" runat="server" Visible="true" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true">
   <Columns>
      <asp:BoundField HeaderText="Make" DataField="Location" />
      <asp:BoundField HeaderText="Model" DataField="City" />
      <asp:BoundField HeaderText="Year" DataField="State" />
      <asp:BoundField HeaderText="Damage" DataField="Zip" />
      <asp:BoundField HeaderText="Final Condition" DataField="County" />
      <asp:BoundField HeaderText="Estimated Worth" DataField="SPLC" />
      <asp:TemplateField HeaderText="Sale Country">
         <EditItemTemplate>
            <asp:DropDownList ID="ddlCountry" runat="server" DataTextField="description" DataValueField="code" DataSource=<%#DataSetCountries%
            
></asp:DropDownList>
         </EditItemTemplate>
      </asp:TemplateField>
   </Columns>
</asp:GridView>
</div>
</form>
</
body>
</
html>

--VB.NET CODE BEHIND--

Sub page_init(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Init
'Create a base dataset for use with the gridview
If Session("dtsTemp") Is Nothing Then
   
Dim dtsTemp As New DataSet
   
Dim dtrRgn As DataRow
   
If dtsTemp.Tables.Count = 0 Then
      
With dtsTemp
         .Tables.Add(0)
         .Tables(0).Columns.Add(
"Make")
         .Tables(0).Columns.Add(
"Model")
         .Tables(0).Columns.Add(
"Year")
         .Tables(0).Columns.Add(
"Damage")
         .Tables(0).Columns.Add(
"Final_Condition")
         .Tables(0).Columns.Add(
"Estimated_Worth")
         .Tables(0).Columns.Add(
"Sale_Country")
         'Create the data row that will add the first row to the grid
         
dtrRgn = dtsTemp.Tables(0).Rows.Add(0)
         
With dtrRgn
            .Item(0) =
""
            
.Item(1) = ""
            
.Item(2) = ""
            
.Item(3) = ""
            
.Item(4) = ""
            
.Item(5) = ""
      End With
End With
End If
'Set the dtsTemp to the session variable
Session("dtsTemp") = dtsTemp
End If
'Bind the Dataset to the data grid
bindGrid()
End Sub


Sub bindGrid()
   
With grdCarNew
   .DataSource = Session(
"dtsTemp")
   .DataBind()
End With
End Sub


'Example of the editing handler

Sub grdResultEdit(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles grdRgnNew.RowEditing
Dim strSQL As String
strSQL = "SELECT * FROM gimmecountries WHERE codetype = 'country'"
'DataSetCountries is a Protected dataset declared in a region above this code
DataSetCountries = SqlHelper.ExecuteDataset(dbMain, CommandType.Text, strSQL)
With grdRgnNew
   .EditIndex = e.NewEditIndex
   
bindGrid()
End With
End Sub

Any way I hope this gives a basic idea of what I am doing. Is it me that is improperly handling this type of item or is it that vs 2005 beta 2 has a bug in the framework that calls the improper handler if your not using a SqlDataSource for the gridview?

Thanks for the Time

-Cryptic
Alex_80
Asp.Net User
Re: Is the gridview update/cancel command broken is vs2005 beta 2?10/20/2005 7:45:53 AM

0/0

I had a problem close to yours.
Try to specify the DataKeyNames that must the primary key of the dataset.

When you click on Delete you must give to your delete function the gridView.SelectedDataKey.Value parameter (the Primary Key of the selected row).

Good luck
Ale.
CrypticDust
Asp.Net User
Re: Is the gridview update/cancel command broken is vs2005 beta 2?10/31/2005 2:52:42 PM

0/0

This worked very well, thank you for the tip.

 

-Crypticdust

Alex_80
Asp.Net User
Re: Is the gridview update/cancel command broken is vs2005 beta 2?11/2/2005 10:20:23 AM

0/0

You're welcome.
Ale.

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Is the gridview update/cancel command broken is vs2005 beta 2 ... Is the gridview update/cancel command broken is vs2005 beta 2? Last post 11-02- 2005 6:20 AM by Alex_80. 3 replies. Sort Posts: ...
Feedback: Override SavePageStateToPersistenceMedium With Nested ... 2) Place another gridview in the EditItemTemplate of the top gridview. ... You may want to try your scenario on the Beta2 build to see if it is working ...
TheMSsForum.com >> Asp >> Findcontrol on Gridview Boundfield ... Creating Ajax Web Application in VS 2005 I am using Visual Studio SP1 and just created an Ajax .... Corregido ya en ASP.net 3.5 beta 2 Sys. ...
SSW Microsoft Visual Studio .NET Suggestions Creating Add-In for Visual Studio 2005 Beta 2 Suggestions ..... 2. Perform DELETE commands. 3. Perform UPDATE commands. 4. Perform INSERT commands. ...
.NET ASP Page 60 - Bytes Site Map Broken image links using Visual Studio 2005 Development Server .... NET Spell checker available? use Formview cancel commandname to return to GridView Page? ...
visual studio 2005 control select visible visual studio 2005 ... ... 2005 toolbox auto hide visual studio 2005 toolbox broken visual studio 2005 ... beta torrents visual studio 2008 beta2 visual studio 2008 beta2 download ...
TheMSsForum.com >> Asp >> Cannot Add Web Reference in VS2005 (but ... add new row to gridview with totals On my gridview I need to a add a new row .... update the proxy settings in vs2005 configuration file: ...
>> Visual Studio 2008 >> Archive Page 88 30537: how to get the datacontext of a dropdown in a gridview .... 30673: VS 2008 Beta 2 can install with VS 2005 SP1 with WPF extensions? ...
.net_2.0 Guess the assumption would be that previous Beta 2 installs when uninstalled didn't do ..... 2. I nested the modal update panel into the gridview panel and ...
VS‘05,SQLServer‘05andMore find it useful to bring a laptop with VS 2005 Beta 2 or later pre-installed. .... 2 p.m.. The ASP.NET 2.0 GridView and DetailsView controls add tremendous ...




Search This Site:










request.querystring usage

how to choose a dtd?

2.0 - data provider error

uploading to file system rather than database

why does the weather module work for some cities and not others?

column 'hometabid' does not belong to table . ?!?

dynamic and static content in drop down list - how to put both at the same time?

required field validator and image

installation error

custom module permission checking?

installing vwd

module edit rights problem - 3.1 - please help

survey module defect (?)

title tag not rendering correctly

passing a value to another page in c#?

timespan years

error during installing vs 2005- please help me

login automatically to another web applications

limitations of skinid

forum software

treeview control in asp.net 1.1

is there a way to hide a menu item?

why doesn't this work???

html textboxes appear but not web form textboxes

full paths in tab bar

contact module... see only 1 telephone column

moss 2007

what the......unable to find the requested .net framework data provider. it may not be installed.

how can i format a curreny field in the reportviewer

wrapped the projects into microsoft installer (msi)

 
All Times Are GMT