PDA

View Full Version : creating controls


nature
08-11-2004, 06:28 AM
I'm trying to make a control but keep getting an error. Thanks!

[b]quote:Specified argument was out of the range of valid values. Parameter name: index </blockquote id="quote"></font id="quote">
I've included the code.
Ascx file:
[quote]<%@ControlLanguage="VB"Debug=true%>
<%@importNamespace="System"%>
<%@importNamespace="System.Web"%>
<%@importNamespace="System.Web.UI"%>
<%@importNamespace="System.Web.UI.WebControls"%>
<scriptrunat="server">


SublbtnButton_Click(senderAsObject,eAsEventArgs)
response.redirect("../default.aspx")
EndSub

PublicPropertyMyTextAsstring
Get
DimCtrlAsLinkButton=Controls(1)
Me.EnsureChildControls()
ReturnCtrl.Text
EndGet
Set
DimCtrlAsLinkButton=Controls(1)
Me.EnsureChildControls()
Ctrl.Text=Value
EndSet
EndProperty

ProtectedOverridesSubCreateChildControls()

Me.Controls.Add(NewLiteralControl("<tableborder=1><tr><td>"))
dimlbtnButtonasnewLinkButton
'lbtnButton.text="clickhere"
addHandlerlbtnButton.click,AddressOflbtnButton_Cli ck
lbtnButton.visible=true

Me.Controls.Add(lbtnButton)

Me.Controls.Add(NewLiteralControl("what'sgoingon?"))
Me.Controls.Add(NewLiteralControl("</td></tr></table>"))
EndSub
</script>

</CODE>

[quote]<%@PageLanguage="VB"%>
<%@RegisterTagPrefix="uc0"TagName="test"Src="test.ascx"%>
<scriptrunat="server">

'UserControl1.PhLinks.controls.add(newLiteralContr ol("Helloworld"))

</script>
<html>
<head>
</head>
[b]
<formrunat="server">
<uc0:testid="UserControl1"Mytext="clickhere"runat="server"></uc0:test>
<!--Insertcontenthere-->
</form>
</body>
</html>
</CODE>

Eric
08-11-2004, 07:39 AM
Did you upload the "webctrl_client" directory?

nature
08-11-2004, 09:33 AM
[b]quote:Originally posted by dasp

Did you upload the "webctrl_client" directory?
</blockquote id="quote"></font id="quote">

No. As I understand, that is for the IE webcontrols like TabStrip. I'm just using standard controls.

Eric
08-11-2004, 10:47 AM
Please see: http://kb.discountasp.net/article.aspx?id=10037

DiscountASP.NET
http://www.DiscountASP.NET

nature
08-11-2004, 11:32 AM
Thanks but I'm NOT using Internet Explorer Web Controls.

[b]quote:Originally posted by dasp

Please see: http://kb.discountasp.net/article.aspx?id=10037

DiscountASP.NET
http://www.DiscountASP.NET
</blockquote id="quote"></font id="quote">

Matthew Gambill
08-20-2004, 10:04 AM
not sure what your trying to do with the code but a few things come to mind.
1) the code your using appears to be from a custom controls rather than a user controls.

2)instead of setting the property directly to the control save it as a string and in your create sub call the property.At the time your calling the property i don't think the control is created yet.

hope this helps, also not sure if you have visual studio but if you do saving in code behind will allow you to debug.

Matt G.
NMyVision.com
Developer / Designer