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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ObjectDataSource Form InsertItemTemplate Freld ValueObjectDataSource Form InsertItemTemplate Freld Value
Previous
 
Next
New Post
11/9/2007 3:38 PM
 

 

I'm trying to check to see if the item is already in the database. 

The problem I'm having deals with UserWebSiteTextBox.Text   The error is that it is not declared.  I tried fv1.InsertItemTemplate.InsertItemTemplate.UserWebSiteTextBox.Text, but I get the same error.  I need to be able to pass the text value to a function called "Proposedwebsite" which will return the userID that has that web site.   If a userID exists then cancel the insert and tell them to try again.

So here is the code:

 

Sub odsLandingPages_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles odsLandingPages.InsertingDim ProposedWebSite As String
UserWebSiteTextBox.Text = ProposedWebSiteIf CheckWebSite(ProposedWebSite) > 1 Then'User account is found with that web site name

e.Cancel =

True

btnAddNewSite.Text =

"Name Already Taken, Try Another"

 

Else

 

'Web site not found

e.Cancel =

False

btnAddNewSite.Text =

"Update Successful - Add Another Web Site?"

 

End If

 

End Sub

 

 

 

 

 

Protected

 
New Post
11/11/2007 9:22 AM
 

It appears that "UserWebSiteTextBox.Text" if a field in your GridView (or FormView)? In that case it might be beter to wire up a method to the row updating event on the GridView (or Item Inserting on the FormView). Then you can cast the "sender" parameter into, for example a FormView, then use the ".FindControl(.." to find the text box.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
11/14/2007 9:51 PM
 

I wired it up to InsertingItem.  This is for a FormView Control.  Where I assign ProposedWebSite to the .findcontrol I get a message stating that the value cannot be converted to a string.  I aslo tried the CTYPE but that did not work either.
 

Protected Sub InsertingItem(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles fv1.ItemInserting

Dim ProposedWebSite As String = fv1.FindControl("UserWebSiteTextBox")

If CheckWebSite(ProposedWebSite) > 1 Then
'User account is found with that web site name
e.Cancel = True
btnAddNewSite.Text = "Name Already Taken, Try Another"

Else
'Web site not found
e.Cancel = False
e.Values.Item("UserID") = Entities.Users.UserController.GetCurrentUserInfo.UserID
e.Values.Item("ModuleID") = ModuleId.ToString()
e.Values.Item("ID") = 0
btnAddNewSite.Text = "Update Successful - Add Another Web Site?"

End If
End Sub

 
New Post
11/14/2007 10:14 PM
 

Also tried:

Dim

ProposedWebSite As TextBox = fv1.FindControl("UserWebSiteTextBox")
Dim ProposedWebSite As TextBox = CType(fv1.FindControl("UserWebSiteTextBox"), TextBox)

And now get: "No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type."

Then I tried:

 

Dim tb As TextBox = CType(fv1.FindControl("UserWebSiteTextBox"), TextBox)
Dim ProposedWebSite = tb.Text

And Get: "Exception has been thrown by the target of an invocation.

These only happend when I'm trying to submit the site name.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ObjectDataSource Form InsertItemTemplate Freld ValueObjectDataSource Form InsertItemTemplate Freld Value


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