Advertisement

05.10.2008 at 10:58AM PDT, ID: 23391873 | Points: 250
[x]
Attachment Details

Gridview update does not trigger / session loss on an update

Tags: ASP.NET, C#, Firstfox, IE6, IE7
Hey,

 
As you can see I have 2 problems.

 

The first is a gridview with an auto generated edit and delete button. All events work except for the update event. I set a breakpoint to confirm the not triggering of my update command (It is more like it just postbacks). The html of my gridview is on the code snippit.

I already tried to replace the autogenerated edit and delete buttons with custom made buttons. I had to add validaterequest="false" and Enableeventvalidation="false" to get it runnable without errors. But still with the same problem. Any solution?

 

The second is a custom made resource editor. I update the  resource with the code shown below the gridview code. What happens is that I start editing one row. And press the update button. The row gets update just fine but my session is gone afther the postback. So I get kicked out of the admin part of the website. And there is no Session.clear or remove to be found in my website.
 

Thank you in advanced,

With kind regards,

Kevin Hendricks.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
<asp:GridView ID="Productgv" runat="server" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true"
            OnRowDeleting="Product_Deleting" OnRowEditing="Product_Editing"
            DataKeyNames="ID" OnRowCancelingEdit="Product_CancelEditing" OnRowUpdating="Product_Updating">
            <Columns>
            <asp:TemplateField HeaderText="ID" Visible="False">
                <ItemTemplate>
                    <asp:HiddenField ID="IDif" runat="server" Value='<%# Eval("ID") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:HiddenField ID="IDif" runat="server" Value='<%# Eval("ID") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Image alt">
                <ItemTemplate>
                    <asp:Label ID="ImageAlterlbl" runat="server" Text='<%# Eval("ImageAlter") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="ImageAltertb" runat="server" Text='<%# Eval("ImageAlter") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Image url">
                <ItemTemplate>
                    <img src='<%# Eval("ImageUrl") %>' alt='<%# Eval("ImageAlter") %>' />
                    <asp:HiddenField ID="ImageUrlhf" runat="server" Value='<%# Eval("ImageUrl") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:HiddenField ID="ImageUrlhf" runat="server" Value='<%# Eval("ImageUrl") %>' />
                    <table>
                    <tr>
                        <td><asp:Label ID="Changelbl" runat="server" Text="Change picture:"></asp:Label></td>
                        <td><asp:CheckBox ID="Changecb" runat="server" /></td>
                    </tr>
                    <tr>
                        <td colspan="2"><asp:Label ID="Validationlbl" runat="server" Text="" Visible="false" ForeColor="red"></asp:Label></td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="apImageUrllbl" runat="server" Text="Select Image:"></asp:Label></td>
                        <td><asp:FileUpload ID="apImageUrlfu" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="Existslbl" runat="server" Text="Overwrite:"></asp:Label></td>
                        <td><asp:CheckBox ID="Existscb" runat="server" /></td>
                    </tr>
                    </table>
                    <img src='<%# Eval("ImageUrl") %>' alt='<%# Eval("ImageAlter") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Product Title">
                <ItemTemplate>
                    <asp:Label ID="Titlelbl" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="Titletb" runat="server" Text='<%# Eval("Title") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Product Info">
                <ItemTemplate>
                    <asp:Label ID="Informationlbl" runat="server" Text='<%# Eval("Information") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="Informationtb" runat="server" Text='<%# Eval("Information") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            </Columns>
            </asp:GridView>     
 
 
 protected void ResourceGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label lbl = (Label)ResourceGridview.Rows[e.RowIndex].FindControl("Label1");
        TextBox TextBox1 = (TextBox)ResourceGridview.Rows[e.RowIndex].FindControl("TextBox1");
 
        XmlDocument loResource = new XmlDocument();
        loResource.Load(Server.MapPath("~/App_GlobalResources/" + ResourceListDropdownlist.SelectedItem.ToString()));
 
        XmlNode loRoot = loResource.SelectSingleNode("root/data[@name='" + lbl.Text + "']/value");
 
        if (loRoot != null)
        {
            loRoot.InnerText = TextBox1.Text;
            loResource.Save(Server.MapPath("~/App_GlobalResources/" + ResourceListDropdownlist.SelectedItem.ToString()));
        }
        ResourceGridview.EditIndex = -1;
        ResourceGridviewFill();
    }
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: biodooms
Question Asked On: 05.10.2008
Participating Experts: 1
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.16.2008 at 06:18AM PDT, ID: 21582388

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.16.2008 at 06:18AM PDT, ID: 21582388
First I would try to delete the grid and add a new one as the update button should work. they have been many times for unknown reasons that my update or edit buttons have stoped working insted of trying to figure out why, I just delate and then add a new one again. better the 1 min of time than the hours of trying to figure out why :)

What is your sesssion timeout set at?
What is the code in the Page_Load event is it checking for role information of something?
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628