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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAdding Fields Add Postback Behavior, Any Ideas?Adding Fields Add Postback Behavior, Any Ideas?
Previous
 
Next
New Post
4/10/2007 5:19 PM
 

Hello,

 

I’ve  made a couple of modifications to the Repository module and they are not acting how I would like them to.  Can anyone point me in the right direction?

 

I have added a test button to the Resource URL so after a user enters the value they can test it.  The code for the test button is:

‘************************************

Dim objButton As New Button

objButton.ID = "__TESTREDIRECTURL"

 

 

objButton.Text = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "TESTREDIRECTURL", "Text", Localization.GetString("TestRedirectURL", oRepositoryBusinessController.LocalResourceFile))

 

objButton.CssClass = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "TESTREDIRECTURL", "CssClass", "normal")

 

 

objButton.CommandName = "TestRedirectURL"

objButton.EnableViewState = True

 

 

objButton.ToolTip = RepositoryBusinessController.GetSkinAttribute(xmlDoc, "TESTREDIRECTURL", "ToolTip", Localization.GetString("TestRedirectURLToolTip", oRepositoryBusinessController.LocalResourceFile))

 

AddHandler objButton.Click, AddressOf btnTestRedirectURL_Click

PlaceHolder.Controls.Add(objButton)

‘***********************************************

 

‘***********************************************

Private Sub btnTestRedirectURL_Click(ByVal sender As Object, ByVal e As System.EventArgs)

 

Dim RedirectURLField As TextBox = PlaceHolder.FindControl("__REDIRECTURL")

 

If Not (RedirectURLField.Text.ToString() = vbNullString) Then

      Response.Write("<script>" & vbCrLf)

Response.Write("window.open('" & RedirectURLField.Text.ToString() & "');" & vbCrLf)

            Response.Write("</script>")

      End If

 

End Sub

‘***********************************************

 

I have also added an id field that is loaded with a random GUID on first load of the form.  When I save the repository item I also save the GUID with it.

 

In the CreateInputForm of the Form.ascx.vb I load the GUID

 

‘***********************************************

Case “XYZ”

Dim objGroupURLGUID As New TextBox

objGroupURLGUID.ID = "__GroupURLGUID"

objGroupURLGUID.Width = System.Web.UI.WebControls.Unit.Pixel(CInt(oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "GroupURLGUID", "Width", "300")))

 

 

objGroupURLGUID.CssClass = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "GroupURLGUID", "CssClass", "normal")

 

objGroupURLGUID.Visible = True

Dim objTextBox As TextBox = PlaceHolder.FindControl("__GroupURLGUID")

If objTextBox Is Nothing Then

objGroupURLGUID.Text = objRepository.GroupURLGUID.ToString

Else

If Not (objTextBox.Text.ToString = vbNullString) Then

            objGroupURLGUID.Text = objTextBox.Text

      Else

            objGroupURLGUID.Text = objRepository.GroupURLGUID.ToString

      End If

End If

objGroupURLGUID.ReadOnly = True

PlaceHolder.Controls.Add(objGroupURLGUID)

‘***********************************************

 

 

Two issues with this:

1)      When I press the test button to test the url I have entered for some reason it is attempting to validate all the standard controls so unless I have data in all the required fields for uploading I am unable to test the url.

2)      When the test button is pressed with all fields populated my guid refreshes, for some reason the PlaceHolder.FindControl("__GroupURLGUID") always returns nothing.  Which I would expect the first time through but not after the PlaceHolder.Controls.Add(objGroupURLGUID) has been called.

 

Thanks in advance.

Dan

 

 
New Post
4/10/2007 10:11 PM
 

Sorry the title should read "ODD" postback behavior.

 
New Post
4/10/2007 11:42 PM
 

I don't have the code base in front of me but it's not really odd behaviour. The fields have a RequiredValidator (I can't remember the exact name of the control so that may not be the correct one) connected to them so if they're empty when a postback is fired they're going to complain. It's been a long time since I've used the validator myself so I can't remember off the top of my head if there's a way around it. If I get a chance tomorrow I'll take a look at the code to see if there's a work around and I'll look at your Test button issue at the same time.

 
New Post
4/11/2007 9:33 AM
 

Thanks.  I think I have solved all the issues with the exception of having to have all fields populated due to the validation.  I just ended up having to store and populate the GUID field at a different stage of the process.

Worst case I can either populate all the fields with dummy values and then finish populating correctly with the ability to use the test buttons, or I could always pull out the vaidation code.  Let me know if you have any recommendations on keeping the validation code in and not having to load all fields first.

Thanks,

Dan

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAdding Fields Add Postback Behavior, Any Ideas?Adding Fields Add Postback Behavior, Any Ideas?


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