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