Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing variables - Edit controlUsing variables - Edit control
Previous
 
Next
New Post
9/26/2011 2:38 AM
 
Hi,I'm developing a simple module and run into the following issue:in my Edit control I'm checking if the user clicked "Add content" and if so I add a new record in the data table and get back the ID of the new record. This works fine. Next, if the user clicks Cancel (or Delete) I call the dataprovider Delete function with the same ID but nothing happens (I've discovered that the value of the variable containing the ID is -1).As I'm more familiar with VB6 development maybe I missed something. So, the code is:#Region "Private Members" Private intId As Integer = Common.Utilities.Null.NullInteger#End Region#Region "Event Handlers" Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try If Not (Request.QueryString("intId") Is Nothing) Then intId = Int32.Parse(Request.QueryString("intId")) End If If Page.IsPostBack = False Then cmdDelete.Attributes.Add("onClick", " return confirm('" & Localization.GetString("DeleteItem") & "');") If Common.Utilities.Null.IsNull(intId) Then Dim objMyController As New myController intId = objMyController.AddMyData.... Private Sub cmdCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancel.Click Try If Left(Label1.Text, 7) = "Dodajem" Then Dim objMyController As New myController objMyController.DeleteMyData(intId).....The funny thing is that if I use labels for storing data instead of variables, everything works as expected. What am I doing wrong?
 
New Post
9/26/2011 3:28 AM
 
it looks like your code simply doesnt find the querystring variable i.e. Common.Utilities.Null.NullInteger is equal to -1 so intID is set to that and then later on as your code checks to see if a querystring value exists before setting it, as it isnt found it never sets the value. Without seeing all your code its hard to say what happens i.e. are you posting the value (i.e. a request.form value) rather than a querystring, or is the url not formatted correctly or do you lose the value before you do the redirect etc. Id recommend you debug your code so you can step through line by line to see what the issue may be.

Based on your description I'd say that you're failing to pass the id into the url so that when it postbacks the value is lost- either persist it within the page (eg. viewstate) or else update the navigateurl value for your cancel/delete links after you add a record.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/26/2011 3:44 AM
 
Hi,thank you for your quick answer. I'll try what you suggested, but basically the process is the following:after the page is displayed (the page is empty except for two labels, a textbox and three linkbuttons - the default edit page created with the starter kit) I check the value of intID, and if -1 I create a new record and store the ID value in intID. So I'm expecting after I click Cancel I can read the value programmaticaly as there were no other postbacks.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing variables - Edit controlUsing variables - Edit control


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out