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...DNN Platform (o...DNN Platform (o...Clearing GridView selection for formView insertClearing GridView selection for formView insert
Previous
 
Next
New Post
9/15/2009 8:39 AM
 

<p>Hi,</p> <p>This may be more of an ASP question than a DNN specific question, but I'm having a lot of difficulty with a couple of data controls I'm using in a module.</p> <p>I have a GridView control and a formView control.&#160; The idea is that the user selects an item from the GridView for editing and this populates the formView.&#160; I have 2 LinqDataSource objects, one to populate the GridView and one to populate the formView using the selection from the GridView in its 'where' clause.&#160; That all works fine.&#160; However, I also want to use the formView to insert new records, in which case I want it displayed with blank fields.&#160; I have a button control which invokes the formView in insert mode for that purpose.&#160; The problem I run into is that once a row has been selected in the GridView, the details from that row will always show up in the formView even when in insert mode.&#160; If I go directly to insert before selecting a GridView row, then it works fine, but I can't find a way to clear the GridView selection once it has already been established.&#160; I've tried setting the GridView.SelectedIndex to -1, but that results in a '<span class="Normal" id="dnn_ctl01_lblMessage">Operator '==' incompatible with operand types 'Int32' and 'Object'' error message for the formView datasource, presumably because the selection item is now null or void.<br /> </span></p> <p>Surely, this must be a common requirement.&#160; Can anyone tell me how to resolve this, please?</p> <p>Thanks,</p> <p>Ed</p>

 
New Post
9/16/2009 9:50 AM
 

Ouch! My apologies for the garbled HTML mash-up in my last post.  I don't know how that got in there.

I think I have solved my own problem by taking a different approach.  I have attched DataBinding event handlers to the insert template fields in the formView.  These event handlers just clear the fields.  It all seems to work fine now, although it seems like a very round-about way to go about it. 

It brings up another question, though.  From the reading I've done it appears that the 'normal' formView behaviour for inserting is to insert a new blank object and then present the blank object for editing.  My question is two-fold: is that a correct interpretation, and if so, what do you do about cancellations?  If the record is already inserted and the user opts to cancel the operation, does that mean the application has to back out the record insertion?  On further reflection it would seem that I've misconstrued something, because what happens with non-null DB fields if you are inserting a blank object?

I suppose what I'm really asking is for someone to lay out the correct procedure for inserting new records in a datasource using the formView control.

Thanks,

Ed

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Clearing GridView selection for formView insertClearing GridView selection for formView insert


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