Showing posts with label folks. Show all posts
Showing posts with label folks. Show all posts

Thursday, March 22, 2012

Strongly-Typed

Hi Folks,

Can someone please explain for me the term:Strongly-Typed please?

I recently heard about it a lot of times.

thanks in advance,

http://en.wikipedia.org/wiki/Strong_typing

Thanks, but it's too general for me.

I need maybe some example please.

Thank You.


ok. Look at this nice example

Strong vs. Weak typing

The division to strong and weak typed languages is much less clear-cut than static vs. dynamic, and there is a lot of confusion on what strong typing means. One common definition isdisallowing operations on incompatible types. Consider the following example from Perl (a weakly typed language):

print "2" + 4;

This code will print '6�� although it seemingly performs addition on incompatible types. This is because Perl is performing an implicit conversion when it sees we want to add a string that represents a number to another number. On the other hand, Ruby is strongly typed and the above statement will generate aTypeError.

More info:http://eli.thegreenplace.net/2006/11/25/a-taxonomy-of-typing-systems/


Ok...

I get something.

Thanks a lot.

Tuesday, March 13, 2012

Struggling With Concept

Hi Folks,
As you may know I'm new to ASP.NET and Im having trouble
grappling with one concept.
If I create a user control and place it on a page I can access its public
properties through a pre-render block, But I cant access its public
properties via code. In say the Page_Load event.
Surely if the control is registered, when the Page_Load Loads, it must have
access to the UserControl Object otherwise whats the point?
Please tell me where Im going wrong !
CheersHi,
What you need to do is access the usercontrol directly, for example: -
Page_Load(...)
{
((myusercontroltype)this.FindControl("UserControlInstance1")).<Property>
}
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Thank you so much for that, I knew it should be possible, but I must have
missed that Method somehow. I tried this instantly and it work just
absolutely fine.
Thanks Again for your help.
Best Regards - OHM
"Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote i
n
message news:caep52$9ft@.odah37.prod.google.com...
> Hi,
> What you need to do is access the usercontrol directly, for example: -
> Page_Load(...)
> {
> ((myusercontroltype)this.FindControl("UserControlInstance1")).<Property>
> }
> Hth,
> Phil Winstanley
> Microsoft ASP.NET MVP
> http://www.myservicescentral.com
>
You can also declare the control at the module level and use the withevents
keyword to expose its events if they are needed. Then you can reference the
control via the code editor.
#Region " Web Form Designer Generated Code "
'Instantiate the control here and you can use it throughout the page by
name.
Protected WithEvents MyUserControl As New MyUserControl
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
With Me.MyUserControl
.DataSource = SomeDataSource
.Text = "SomeValue"
.SomeOtherProperty = "SomeOtherValue"
End With
End If
End Sub
"One Handed Man ( OHM#)" <news.microsoft.com> wrote in message
news:uazb75GUEHA.1048@.tk2msftngp13.phx.gbl...
> Hi Folks,
> As you may know I'm new to ASP.NET and Im having trouble
> grappling with one concept.
> If I create a user control and place it on a page I can access its public
> properties through a pre-render block, But I cant access its public
> properties via code. In say the Page_Load event.
> Surely if the control is registered, when the Page_Load Loads, it must
> have
> access to the UserControl Object otherwise whats the point?
> Please tell me where Im going wrong !
> Cheers
>

Struggling With Concept

Hi Folks,
As you may know I'm new to ASP.NET and Im having trouble
grappling with one concept.

If I create a user control and place it on a page I can access its public
properties through a pre-render block, But I cant access its public
properties via code. In say the Page_Load event.

Surely if the control is registered, when the Page_Load Loads, it must have
access to the UserControl Object otherwise whats the point?

Please tell me where Im going wrong !

CheersYou can also declare the control at the module level and use the withevents
keyword to expose its events if they are needed. Then you can reference the
control via the code editor.

#Region " Web Form Designer Generated Code "
'Instantiate the control here and you can use it throughout the page by
name.
Protected WithEvents MyUserControl As New MyUserControl

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
With Me.MyUserControl
.DataSource = SomeDataSource
.Text = "SomeValue"
.SomeOtherProperty = "SomeOtherValue"
End With
End If
End Sub

"One Handed Man ( OHM#)" <news.microsoft.com> wrote in message
news:uazb75GUEHA.1048@.tk2msftngp13.phx.gbl...
> Hi Folks,
> As you may know I'm new to ASP.NET and Im having trouble
> grappling with one concept.
> If I create a user control and place it on a page I can access its public
> properties through a pre-render block, But I cant access its public
> properties via code. In say the Page_Load event.
> Surely if the control is registered, when the Page_Load Loads, it must
> have
> access to the UserControl Object otherwise whats the point?
> Please tell me where Im going wrong !
> Cheers

Stuck on loading pages into a placeholder

Hi Folks,

Can someone point me to a sample or tutorial or the code to load pages into a placeholder.

I have a menu bar on the left of the page and am trying to load the clicked pages on the right.

Any ideas,

Cheers
NickWelcome to the ASP.NET forums, Nick.

You may be very interested inUser Controls. (They were originally called Pagelets, since they are very much like you described ... littles pages that you embed within your main page.)

That link is one of theQuickStart Tutorials which you might want to look through.

Hope this helps.
Hmm ive had a read over and im still stuck.

do i include the code in a script block or in the codebehind file??
Umm, neither.

Can you show the code for your page, indicating which part you want to separate out as the menu bar, and which page will have the content loaded into it?

If you do so, can you please post it between<code> and</code> tags?
Here it is.


for the link
<TD>
<a id="goHome" runat="server"><img src="http://pics.10026.com/?src=images/myWebHome.jpg"></a>
</TD>
with goHome.HRef defined in the cs file.

<TABLE cellSpacing="10" cellPadding="0" width="100%" border="0">
<asp:placeholder id="PageBody" runat="server"></asp:placeholder>
</TABLE>

I'm trying to get the link to display in the placeholder.
Cheers,
Nick
Why not use frames?
One more question before I can show you an answer.

When you say you are trying to load "pages" into a Placeholder, do you mean anentire webpage inside the table cell? Or do you just want to load differentcontent into the table cell, based on the button the user has clicked?
At the moment it is content contained within an aspx file, so an entire page I guess, what other options are available. I'm a bit of a noob to all this and have to get myself on a steep learning curve. Thanks for all your help and time.
You should really be putting yoursections of content in a User Control (.ascx), Loading them (using Page.LoadControl) when appropriate and then adding them to the PlaceHolder Control. For example:

 void Page_Load ( Object src, EventArgs eArgs ) {

Control page;

switch ( QueryString [ "page" ] ) {

case "Home" : page = LoadControl ( "/controls/home.ascx" );
break;
case "About" : page = LoadControl ( "/controls/about.ascx" );
break;
...
}

PageBody.Controls.Add ( page );
}


I assume this goes into a <script> block in the actual page. Now how do I pass the param to the switch?
Either in a <script> declaration block or CodeBehind.

The requesting URL would look like:

 http://www.domain.com/default.aspx?page=Home