Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Saturday, March 31, 2012

the asp.net application doesnt compile it self under the /bin directory, where it is?

I want to use my custom control (.cs) in my web application. Custom control
is in the same assembly as my application. I want to know the name of the
assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name.
But in asp.net 2.0 i can't find the assembly. It is not compiled under the
/bin folder. Where it is, or how can i give a reference to it?re:
> I want to use my custom control (.cs) in my web application.

Custom controls aren't located in *.cs files.
Classes are included in *.cs files.

Can you clarify what you are looking for ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message
news:uxcKX7t6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> I want to use my custom control (.cs) in my web application. Custom control is in the
> same assembly as my application. I want to know the name of the assembly (.dll) file so
> i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name. But in asp.net 2.0 i can't find the
> assembly. It is not compiled under the /bin folder. Where it is, or how can i give a
> reference to it?
I mean, not the *.ascx (User controls), custom control.

Let me ask my question in this way: I can't add my custom control in a web
page because i don't know what to write in the <@dotnet.itags.org.Page Assembly=''> register
tag.

"Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> wrote in message
news:Oo7QLKu6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> re:
>> I want to use my custom control (.cs) in my web application.
> Custom controls aren't located in *.cs files.
> Classes are included in *.cs files.
> Can you clarify what you are looking for ?
>
> Juan T. Llibre, ASP.NET MVP
> ASP.NET FAQ : http://asp.net.do/faq/
> ASPNETFAQ.COM : http://www.aspnetfaq.com/
> Foros de ASP.NET en Espaol : http://asp.net.do/foros/
> ======================================
> "Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message
> news:uxcKX7t6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>>
>> I want to use my custom control (.cs) in my web application. Custom
>> control is in the same assembly as my application. I want to know the
>> name of the assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister
>> Assembly="abc.dll"> name. But in asp.net 2.0 i can't find the assembly.
>> It is not compiled under the /bin folder. Where it is, or how can i give
>> a reference to it?
OK...

For that, check out :
http://support.microsoft.com/defaul...kb;en-us;321749

The proper tag is :
<%@dotnet.itags.org. Register TagPrefix="Custom" Namespace="CustomControlNamespace" Assembly= "CustomControl" %
Custom is an alias that you associate with a namespace.
CustomControlNamespace is a namespace in which classes of an assembly are enclosed.
CustomControl is the name of the assembly file without an extension (.dll).


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message news:uI%23L45u6FHA.1000@dotnet.itags.org.tk2msftngp13.phx.gbl...
>I mean, not the *.ascx (User controls), custom control.
>
> Let me ask my question in this way: I can't add my custom control in a web
> page because i don't know what to write in the <@dotnet.itags.org.Page Assembly=''> register
> tag.
>
>
> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> wrote in message
> news:Oo7QLKu6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>> re:
>>> I want to use my custom control (.cs) in my web application.
>>
>> Custom controls aren't located in *.cs files.
>> Classes are included in *.cs files.
>>
>> Can you clarify what you are looking for ?

>> "Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message
>> news:uxcKX7t6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>>>
>>> I want to use my custom control (.cs) in my web application. Custom
>>> control is in the same assembly as my application. I want to know the
>>> name of the assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister
>>> Assembly="abc.dll"> name. But in asp.net 2.0 i can't find the assembly.
>>> It is not compiled under the /bin folder. Where it is, or how can i give
>>> a reference to it?
On Wed, 16 Nov 2005 10:52:05 -0800, "Umut Tezduyar"
<umut@dotnet.itags.org.tezduyar.com> wrote:

>I want to use my custom control (.cs) in my web application. Custom control
>is in the same assembly as my application.

Is this 2.0? (I assume so based on your previous questions). Your
custom control must be in App_Code, correct?

Something like this:

namespace OTC
{
public class MyCustomControl : WebControl
{
protected override void Render(HtmlTextWriter writer)
{
writer.Write("This is my custom control");
base.Render(writer);
}
}
}

>I want to know the name of the
>assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name.
>But in asp.net 2.0 i can't find the assembly. It is not compiled under the
>/bin folder. Where it is, or how can i give a reference to it?

ASP.NET builds App_Code as a separate assembly, and the runtime will
recognize "App_Code" as an assembly name in a reference directive.

<%@dotnet.itags.org. Register Assembly="App_Code" TagPrefix="otc" Namespace="OTC" %
...

<otc:MyCustomControl runat="Server" id="boo" /
--
Scott
http://www.OdeToCode.com/blogs/scott/

the asp.net application doesn't compile it self under the /bin directory, where it is

I want to use my custom control (.cs) in my web application. Custom control
is in the same assembly as my application. I want to know the name of the
assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name.
But in asp.net 2.0 i can't find the assembly. It is not compiled under the
/bin folder. Where it is, or how can i give a reference to it?re:
> I want to use my custom control (.cs) in my web application.
Custom controls aren't located in *.cs files.
Classes are included in *.cs files.
Can you clarify what you are looking for ?
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message
news:uxcKX7t6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> I want to use my custom control (.cs) in my web application. Custom contro
l is in the
> same assembly as my application. I want to know the name of the assembly (
.dll) file so
> i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name. But in asp.net 2.0 i c
an't find the
> assembly. It is not compiled under the /bin folder. Where it is, or how ca
n i give a
> reference to it?
I mean, not the *.ascx (User controls), custom control.
Let me ask my question in this way: I can't add my custom control in a web
page because i don't know what to write in the <@dotnet.itags.org.Page Assembly=''> register
tag.
"Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> wrote in message
news:Oo7QLKu6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> re:
> Custom controls aren't located in *.cs files.
> Classes are included in *.cs files.
> Can you clarify what you are looking for ?
>
> Juan T. Llibre, ASP.NET MVP
> ASP.NET FAQ : http://asp.net.do/faq/
> ASPNETFAQ.COM : http://www.aspnetfaq.com/
> Foros de ASP.NET en Espaol : http://asp.net.do/foros/
> ======================================
> "Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message
> news:uxcKX7t6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
>
OK...
For that, check out :
http://support.microsoft.com/defaul...kb;en-us;321749
The proper tag is :
<%@dotnet.itags.org. Register TagPrefix="Custom" Namespace="CustomControlNamespace" Assembly=
"CustomControl" %>
Custom is an alias that you associate with a namespace.
CustomControlNamespace is a namespace in which classes of an assembly are en
closed.
CustomControl is the name of the assembly file without an extension (.dll).
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Espaol : http://asp.net.do/foros/
======================================
"Umut Tezduyar" <umut@dotnet.itags.org.tezduyar.com> wrote in message news:uI%23L45u6FHA.1000@dotnet.itags.org.tk2msftngp13.p
hx.gbl...
>I mean, not the *.ascx (User controls), custom control.
>
> Let me ask my question in this way: I can't add my custom control in a web
> page because i don't know what to write in the <@dotnet.itags.org.Page Assembly=''> registe
r
> tag.
>
>
> "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com> wrote in message
> news:Oo7QLKu6FHA.2036@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
On Wed, 16 Nov 2005 10:52:05 -0800, "Umut Tezduyar"
<umut@dotnet.itags.org.tezduyar.com> wrote:

>I want to use my custom control (.cs) in my web application. Custom control
>is in the same assembly as my application.
>
Is this 2.0? (I assume so based on your previous questions). Your
custom control must be in App_Code, correct?
Something like this:
namespace OTC
{
public class MyCustomControl : WebControl
{
protected override void Render(HtmlTextWriter writer)
{
writer.Write("This is my custom control");
base.Render(writer);
}
}
}

>I want to know the name of the
>assembly (.dll) file so i can add it's <@dotnet.itags.org.Pegister Assembly="abc.dll"> name.
>But in asp.net 2.0 i can't find the assembly. It is not compiled under the
>/bin folder. Where it is, or how can i give a reference to it?
>
ASP.NET builds App_Code as a separate assembly, and the runtime will
recognize "App_Code" as an assembly name in a reference directive.
<%@dotnet.itags.org. Register Assembly="App_Code" TagPrefix="otc" Namespace="OTC" %>
...
<otc:MyCustomControl runat="Server" id="boo" />
Scott
http://www.OdeToCode.com/blogs/scott/

Wednesday, March 28, 2012

The best way to validate UserControls

Hi,
I have a user control that has a property named "Text"
Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?
I tried it and I received this error:
Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.
Thank you,
MaxOn Jul 13, 10:05 pm, "Max2006" <alanal...@dotnet.itags.org.newsgroup.nospam> wrote:
> Hi,
> I have a user control that has a property named "Text"
> Is there any way that I use a RequiredFieldValidator or CompareValidator t
o
> validate my user control's value?
> I tried it and I received this error:
> Control 'cboCountry' referenced by the ControlToValidate property of
> 'valCountry' cannot be validated.
> Thank you,
> Max
Hi...
i assume you have a control inside the usercontrol that receive input
from user and you do want to validate the input ...
here are the options you have...
1. add the requited field validator for the input in the usercontrol
rather that in the page...
2. validate the text using server side validation... (for this you
need to write a server side validation method...)
Thanks
Md. Masudur Rahman (Munna)
kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
Hi Max,
Yes, I agree with Masudur's opinion. Also, if you do want to make Validator
controls directly function against your ascx usercontrol, you can use the
"ValidationPropertyAttribute" class to define a property to be validatable
in your ascx control's code behind.
#ValidationPropertyAttribute Class
http://msdn2.microsoft.com/en-us/li...tionpropertyatt
ribute(VS.80).aspx
Based on my test, through the intellisense not work, you can manually put
usercontrol's ID to validateor's "ControlToValidate" property and so far it
seems only server-side validation is working in this case.
Anyway, I think Masudur's suggested approaches are still the preferred ones
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Max,
Have you got any further idea on this or does the information helps you
some? Please feel free to post here if there is anything else we can help.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

The best way to validate UserControls

Hi,

I have a user control that has a property named "Text"

Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?

I tried it and I received this error:

Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.

Thank you,
MaxOn Jul 13, 10:05 pm, "Max2006" <alanal...@dotnet.itags.org.newsgroup.nospamwrote:

Quote:

Originally Posted by

Hi,
>
I have a user control that has a property named "Text"
>
Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?
>
I tried it and I received this error:
>
Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.
>
Thank you,
Max


Hi...

i assume you have a control inside the usercontrol that receive input
from user and you do want to validate the input ...
here are the options you have...
1. add the requited field validator for the input in the usercontrol
rather that in the page...
2. validate the text using server side validation... (for this you
need to write a server side validation method...)

Thanks
Md. Masudur Rahman (Munna)
kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
Hi Max,

Yes, I agree with Masudur's opinion. Also, if you do want to make Validator
controls directly function against your ascx usercontrol, you can use the
"ValidationPropertyAttribute" class to define a property to be validatable
in your ascx control's code behind.

#ValidationPropertyAttribute Class
http://msdn2.microsoft.com/en-us/li...tionpropertyatt
ribute(VS.80).aspx

Based on my test, through the intellisense not work, you can manually put
usercontrol's ID to validateor's "ControlToValidate" property and so far it
seems only server-side validation is working in this case.

Anyway, I think Masudur's suggested approaches are still the preferred ones
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Max,

Have you got any further idea on this or does the information helps you
some? Please feel free to post here if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 26, 2012

The control that triggered the UpdatePanel controls to refresh

Hi All,
On my page, I have a custom control in which asp server controls can be
added and a UpdatePanel to notify the server of any edit in progress in the
custom control...I would like to know which server control triggered the
postback whitin my custom control. Currently, my customControl is declared a
s
follow:
<daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
runat="server" DisabledStateControlId="Button1"
OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
and the following events will trigger a postback:
document.onchange = handleEvent;
interceptor.onclick = handleEvent;
interceptor.onkeypress = handleEvent;
interceptor.onkeydown = handleEvent;
interceptor.onpaste = handleEvent;
My problem is that after postback, I would like to set the focus on the
control which triggered the post back. So far, I have used the following:
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
and
if
(((ScriptManager)this.Page.FindControl("ScriptManager1")).IsInAsyncPostBack)
fromWhere =
this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1")).I
D];
in order to get the control but i am always getting the custom control. I
want to associated postback events to the custom control only but would like
to know which control within it originated the postback...
Any help will be appreciated.
Thanks,
KikaOn Jan 17, 12:09 pm, Kika <K...@dotnet.itags.org.discussions.microsoft.com> wrote:
> Hi All,
> On my page, I have a custom control in which asp server controls can be
> added and a UpdatePanel to notify the server of any edit in progress in th
e
> custom control...I would like to know which server control triggered the
> postback whitin my custom control. Currently, my customControl is declared
as
> follow:
> <daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
> runat="server" DisabledStateControlId="Button1"
> OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
> and the following events will trigger a postback:
> document.onchange = handleEvent;
> interceptor.onclick = handleEvent;
> interceptor.onkeypress = handleEvent;
> interceptor.onkeydown = handleEvent;
> interceptor.onpaste = handleEvent;
> My problem is that after postback, I would like to set the focus on the
> control which triggered the post back. So far, I have used the following:
> string ctrlname = page.Request.Params.Get("__EVENTTARGET");
> and
> if
> (((ScriptManager)this.Page.FindControl("ScriptManager1")).IsInAsyncPostBac
k)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1"))
.ID];
> in order to get the control but i am always getting the custom control. I
> want to associated postback events to the custom control only but would li
ke
> to know which control within it originated the postback...
> Any help will be appreciated.
> Thanks,
> Kika
You should open up your custom control as open source so I can take a
gander. I've always wanted a control like what you have created. :)
in client script register a BeginRequestHandler and write the control id to
a
hidden field.
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function(sender, args)
{
$get('myHiddenCtl').value = args.get_postBackElement();
});
-- bruce (sqlwork.com)
"Kika" wrote:

> Hi All,
> On my page, I have a custom control in which asp server controls can be
> added and a UpdatePanel to notify the server of any edit in progress in th
e
> custom control...I would like to know which server control triggered the
> postback whitin my custom control. Currently, my customControl is declared
as
> follow:
> <daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
> runat="server" DisabledStateControlId="Button1"
> OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
> and the following events will trigger a postback:
> document.onchange = handleEvent;
> interceptor.onclick = handleEvent;
> interceptor.onkeypress = handleEvent;
> interceptor.onkeydown = handleEvent;
> interceptor.onpaste = handleEvent;
> My problem is that after postback, I would like to set the focus on the
> control which triggered the post back. So far, I have used the following:
> string ctrlname = page.Request.Params.Get("__EVENTTARGET");
> and
> if
> (((ScriptManager)this.Page.FindControl("ScriptManager1")).IsInAsyncPostBac
k)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1"))
.ID];
> in order to get the control but i am always getting the custom control. I
> want to associated postback events to the custom control only but would li
ke
> to know which control within it originated the postback...
> Any help will be appreciated.
> Thanks,
> Kika

The control values are not sent to the form code.

I am new to Web Forms and I ported my little app from Windows Forms to
ASP.NET and I am wondering why some things are not working as before.
Although I figured most of them, one of them is that on my form I have input
fields and a button causing to store all the input fields into the database.
However, when in the button OnClick event I gather all the form control
values by either getting txtBox.Text or lstChoice.SelectedItem, all the
values are not equal to the user choices, but to the values last set by the
form programatically on Form Load. It looks that I am missing some event tha
t
sends the user control values from the client to the server.
Am I missing something?
Thank you
Cezar MartCezar:
Take a look at http://openmymind.net/FAQ.aspx?documentId=2
short answer is you need to wrap the code which initially sets the values in
a if not page.IsPostback then
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Cezar" <Cezar@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:E8548106-843F-4252-A39F-4C40BC63774B@dotnet.itags.org.microsoft.com...
> I am new to Web Forms and I ported my little app from Windows Forms to
> ASP.NET and I am wondering why some things are not working as before.
> Although I figured most of them, one of them is that on my form I have
input
> fields and a button causing to store all the input fields into the
database.
> However, when in the button OnClick event I gather all the form control
> values by either getting txtBox.Text or lstChoice.SelectedItem, all the
> values are not equal to the user choices, but to the values last set by
the
> form programatically on Form Load. It looks that I am missing some event
that
> sends the user control values from the client to the server.
> Am I missing something?
> Thank you
> Cezar Mart
>

The control values are not sent to the form code.

I am new to Web Forms and I ported my little app from Windows Forms to
ASP.NET and I am wondering why some things are not working as before.
Although I figured most of them, one of them is that on my form I have input
fields and a button causing to store all the input fields into the database.
However, when in the button OnClick event I gather all the form control
values by either getting txtBox.Text or lstChoice.SelectedItem, all the
values are not equal to the user choices, but to the values last set by the
form programatically on Form Load. It looks that I am missing some event that
sends the user control values from the client to the server.
Am I missing something?
Thank you
Cezar MartCezar:
Take a look at http://openmymind.net/FAQ.aspx?documentId=2

short answer is you need to wrap the code which initially sets the values in
a if not page.IsPostback then

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

"Cezar" <Cezar@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:E8548106-843F-4252-A39F-4C40BC63774B@dotnet.itags.org.microsoft.com...
> I am new to Web Forms and I ported my little app from Windows Forms to
> ASP.NET and I am wondering why some things are not working as before.
> Although I figured most of them, one of them is that on my form I have
input
> fields and a button causing to store all the input fields into the
database.
> However, when in the button OnClick event I gather all the form control
> values by either getting txtBox.Text or lstChoice.SelectedItem, all the
> values are not equal to the user choices, but to the values last set by
the
> form programatically on Form Load. It looks that I am missing some event
that
> sends the user control values from the client to the server.
> Am I missing something?
> Thank you
> Cezar Mart

The Controls collection cannot be modified because the control contains code blocks (i.e.

Hi,

I'm trying to dynamically set the src of an iframe with the <% %> block:
<iframe id="content" src="http://pics.10026.com/?src=<% = Request.QueryString.Get("content") %>"
width="100%"></iframe
Notice that the tag (intentionally) has no runat=server and also nested in a
<TD> tag...

What am I doing wrong?

Thanks,
HadarHadar,

Looks like you have a balagan with quotes. Try this:
src=<% = String.Format ("'{0}'", Request.QueryString.Get("content") %
Eliyahu

"Hadar" <crazy5@dotnet.itags.org.bezeqint.net> wrote in message
news:uB23lzJlEHA.208@dotnet.itags.org.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm trying to dynamically set the src of an iframe with the <% %> block:
> <iframe id="content" src="http://pics.10026.com/?src=<% = Request.QueryString.Get("content") %>"
> width="100%"></iframe>
> Notice that the tag (intentionally) has no runat=server and also nested in
a
> <TD> tag...
> What am I doing wrong?
> Thanks,
> Hadar
One more bracket:

src=<% = String.Format ("'{0}'", Request.QueryString.Get("content")) %
--
Eliyahu

"Eliyahu Goldin" <removemeegoldin@dotnet.itags.org.monarchmed.com> wrote in message
news:exsYv2KlEHA.3372@dotnet.itags.org.TK2MSFTNGP09.phx.gbl...
> Hadar,
> Looks like you have a balagan with quotes. Try this:
> src=<% = String.Format ("'{0}'", Request.QueryString.Get("content") %>
> Eliyahu
> "Hadar" <crazy5@dotnet.itags.org.bezeqint.net> wrote in message
> news:uB23lzJlEHA.208@dotnet.itags.org.TK2MSFTNGP12.phx.gbl...
> > Hi,
> > I'm trying to dynamically set the src of an iframe with the <% %> block:
> > <iframe id="content" src="http://pics.10026.com/?src=<% = Request.QueryString.Get("content") %>"
> > width="100%"></iframe>
> > Notice that the tag (intentionally) has no runat=server and also nested
in
> a
> > <TD> tag...
> > What am I doing wrong?
> > Thanks,
> > Hadar
Hi Eliyahu,

Thanks for your reply.
I tried what you suggested, and still it doesn't work (same error).
I guess it's not the quotes...

Any other suggestions?

Hadar

> One more bracket:
> src=<% = String.Format ("'{0}'", Request.QueryString.Get("content")) %>
> --
> Eliyahu
> "Eliyahu Goldin" <removemeegoldin@dotnet.itags.org.monarchmed.com> wrote in message
> news:exsYv2KlEHA.3372@dotnet.itags.org.TK2MSFTNGP09.phx.gbl...
> > Hadar,
> > Looks like you have a balagan with quotes. Try this:
> > src=<% = String.Format ("'{0}'", Request.QueryString.Get("content") %>
> > Eliyahu
> > "Hadar" <crazy5@dotnet.itags.org.bezeqint.net> wrote in message
> > news:uB23lzJlEHA.208@dotnet.itags.org.TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > > > I'm trying to dynamically set the src of an iframe with the <% %>
block:
> > > <iframe id="content" src="http://pics.10026.com/?src=<% = Request.QueryString.Get("content")
%>"
> > > width="100%"></iframe>
> > > > Notice that the tag (intentionally) has no runat=server and also
nested
> in
> > a
> > > <TD> tag...
> > > > What am I doing wrong?
> > > > Thanks,
> > > Hadar
> >

Saturday, March 24, 2012

The definiton of client control

Recently, I often saw the terminonlogy, client control.

Could any body provides me the general definiton?

Thanks,

Ricky

Client Controls are the HTML controls

Let me tell you there are 2 kinds of controls Web server Control and HTML Control

Web Server controls have more features than the Client Control

Web Server Controls are converted to HTML control then sent to client side

The dreaded back button

Within an application, is there any way to "tamper" with the history of URLs retained by the browser, so that I can control the URL associated with the back button?

I guess this would entail deleting the last page from the linked list that the browser holds for pages that I do not wish to revisit.

Is this possible?Because of security reasons, you can't get the history from the client.

Thursday, March 22, 2012

The Fileupload Control with the Pocket IE

Hi, I'm developing an application (ASP.NET 2.0) that needs to upload afile from a Pocket PC with Pocket InternetExplorer. I've put aFileUpload Control and it works well with a Internet Explorer in a PC,but doesn't appear if I access from my pocket PC with PocketInternetExplorer.
What's happening?
How can I upload a file from Pocket IE?
THANKS!

Does anyone solved the problem??
I still don't know how to upload files with my Pocket PC windows 2003 mobile.
HEEELP!!

The file web.sitemap required by XmlSiteMapProvider does not exist.

in my website i have a treeview control connected to sitemap.

I get the error

The file web.sitemap required by XmlSiteMapProvider does not exist.

but i have the file web.sitemap in my website.

Here is my code in my masterpage

<asp:SiteMapDataSourceID="SiteMapDataSource1"runat="server"/>

and my web.config

<configuration>
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
</httpHandlers>
<customErrors mode="Off"/>
<compilation debug="true"/></system.web>
<appSettings/>
<connectionStrings>
<add name="estagiosConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\meusite\estagios\estagios.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
<system.web>

</system.web>
</configuration>

in my computer it works fine, but in my web site it doesn't

Any help?

Thank you

found the problem

The file web.sitemap has to be in my website root(strange or maybe not) bu now all my links are wrong.


Hi,

Based on my understanding, when you use the SiteMapPath and SiteMapDataSource controls generate navigation UI. When you run it, the links that are in the SiteMapPath are wrong. If I have misunderstood you, please feel free to let me know.

The Url attribute can indicate avirtual path that corresponds to a page in your application. It can also contain paths to pages in other applications, or URLs that point at completely different web sites. So please make sure that the links that in the web.sitemap are correct.

For more information, seehttp://quickstarts.asp.net/QuickStartv20/aspnet/doc/navigation/sitenavcontrols.aspx.


I hope this helps.

The Focus() method dont work

As title, druing a button-click post back, I set a control, say Button1, to get the focus by Button1.Focus();

However, after the page is rendered, the Button1 still do not gets the focus as if browser window itself gets the focus instead.

Could any body give me some tips the find out the problem?

Note: The page is copied from an existing one and do some modification.

Thanks a lot

Ricky

Regards

it could be that the page is focusing somewhere else due to javascript, or just the browser...

but if you add the following code to your page, you should be able to re-focus where you want it... (add this code at the bottom of your page with the Page.ClientScript.RegisterStartupScript method):

setTimeout(function() { document.getElementById("myTextBox's Client Side ID here...").focus(); }, 250); <-- this will do it after 250 milliseconds (adjust to your needs).

Peace,


Nullable:

it could be that the page is focusing somewhere else due to javascript, or just the browser...

but if you add the following code to your page, you should be able to re-focus where you want it... (add this code at the bottom of your page with the Page.ClientScript.RegisterStartupScript method):

setTimeout(function() { document.getElementById("myTextBox's Client Side ID here...").focus(); }, 250); <-- this will do it after 250 milliseconds (adjust to your needs).

Peace,

Thanks. I have found the bug caused by the invalid HTML markups.

Ricky

Tuesday, March 13, 2012

The infamous post back issue regarding the DropDown list control

Hi everyone,

I'm having a problem with using the DropDown list control in ASP.NET 2.0 and the selected item name not being retained in the control. I have this control on a MasterPage and when you select Blue I do a Response.Redirect to a content page. The problem is I'd like the DropDown list control to retain the name Blue, but it doesn't work it always displays the blank from "" after you make your selection. I have ViewState enabled as well as AutoPostBack on the DropDown list control set to true. If I set AutoPostBack to false, then the selected name is retained, but the Response.Redirect doesn't fire. Please note below:

//MySiteMasterPageprotected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ColorsDropDownList.Items.Add("");
ColorsDropDownList.Items.Add("Red");
ColorsDropDownList.Items.Add("Green");
ColorsDropDownList.Items.Add("Blue");
ColorsDropDownList.Items.Add("Yellow");
}
}

protected void ColorsDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
switch (ColorsDropDownList.SelectedValue)
{
case"Red":
Response.Redirect("~/Red.aspx",false);
break;
case"Green":
Response.Redirect("~/Green.aspx",false);
break;
case"Blue":
Response.Redirect("~/Blue.aspx",false);
break;
case"Yellow":
Response.Redirect("~/Yellow.aspx",false);
break;
}
}

I have searched thorough the forums for similiar issues, but everything I've tried either hasn't worked or was not close enough to my situation.
Thank you, 

What you need to understand about Viewstate isthat it is only applicable within a single page during postbacks; thatis, once you switch pages, all the page data from the prior page isgone.

However, if you must redirect to adifferent page for each color -- and I'm not sure you have to do that,since you could easily make one dynamic page -- you can hard-code theselected value of the DDL for each page. That is, if you're onthe Blue page, youknow the user picked Blue, so you can just set it when the page loads.

Cheers,


I may not have explained this properly. First I tried to pick colors as a simple example; however, the actual application is for a reporting application. There is a MasterPage that contains the TreeView control showing the reports the user is able to access based on their user role. The DropDownList control represents various departments. When the user selects one of the reports they have access to it is displayed in the TreeView it displays the department page with the selected report. Following what you suggested by hard coding I'm not following how to set the DropDown control manually to the department page name that was selected from the DropDownList control.

Report Portal

----------------------------------------------------------

Select: contains the list of depts|

General Rtps | Actual report content is displayed in this area.

Financial Rtps |

Sales Rpts |

Top 5% Sales |

Top 20% Sales |

Inventory Rtps |


Hi

I tried to work the same thing it seems to have worked fine for me, I am giving the full code that I used, may be that will help

MasterPage

-----------------------

<%@. Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID=ColorsDropDownList AutoPostBack=true runat=server OnSelectedIndexChanged="ColorsDropDownList_SelectedIndexChanged1"></asp:DropDownList>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
------------------------

Master page code behind

---------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ColorsDropDownList.Items.Add("");
ColorsDropDownList.Items.Add("Red");
ColorsDropDownList.Items.Add("Green");
ColorsDropDownList.Items.Add("Blue");
ColorsDropDownList.Items.Add("Yellow");
}
}

protected void ColorsDropDownList_SelectedIndexChanged1(object sender, EventArgs e)
{
switch (ColorsDropDownList.SelectedValue)
{
case "Red":
Response.Write("~/Red.aspx");
break;
case "Green":
Response.Write("~/Green.aspx");
break;
case "Blue":
Response.Write("~/Blue.aspx");
break;
case "Yellow":
Response.Write("~/Yellow.aspx");
break;
default:
Response.Write("~/default.aspx");
break;
}
}
}
----------------------

Default page

----------

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content

------------

Hope this helps

thanks

vikram

Vikram's Blog


Ok, yes trying your example does work; however, I am not doing a Response.Write("~/Red.aspx");. I am doing a Response.Redirect("~/Red.aspx", false) to send the user to a page called Red.aspx. Actually this is just an example and not the actual name of the page the user is be redirected to.

Is it possible to get the same effect as using Response.Write, but instead use Response.Redirect??

Thanks,

Lance


When you do a Response.Redirect, all the ViewState information is lost. You need to use a different type of session state to keep track of the value

You could store the value in a session variable and then after the response.redirect read from it

Session["ddlIndex"] = ddlDropDownList.SelectedIndex;

Response.Redirect("otherpage.aspx");

On the other page you would do this

ddlDropDownList.SelectedIndex = (int)["ddlIndex"]


Thanks for the reply James. I see what you are saying, but when I try to compile this I receive a few errors on the line on the other page.

ddlDropDownList.SelectedIndex = (int)["ddlIndex"];

Invalid expression term '['

; exprected

; expected

Invalid expression term ']'

How do I fix this? Also that above line will still maintain the name of the item that was selected from the drop down list control even though the control resides on the Master Page and this is just a content page??

Thanks


It should be ddlDropDownList.SelectedIndex = (int)Session["ddlIndex"];

I didn't check the code so it may have minor syntax errors like forgetting the ; terminator.


Ok, i should have caught that Session was missing also. That takes care of that problem, but I still have an issue with the Drop Down List Control. The name doesn't exist in the current context, because it is located on a different page.


the label control in asp.net 2.0

how do i autosize the width of a label to the width of the text field?Put them in the same column of a table and set their width to 100%.
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"darren" <darren@.discussions.microsoft.com> wrote in message
news:AC0FE30E-B5BC-4900-87B0-5725CDC61BB6@.microsoft.com...
> how do i autosize the width of a label to the width of the text field?
>

the label control in asp.net 2.0

how do i autosize the width of a label to the width of the text field?Put them in the same column of a table and set their width to 100%.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"darren" <darren@.discussions.microsoft.comwrote in message
news:AC0FE30E-B5BC-4900-87B0-5725CDC61BB6@.microsoft.com...

Quote:

Originally Posted by

how do i autosize the width of a label to the width of the text field?
>
>

The JScript "getYear" does not work in Mozilla ? :-)))

Hi. I have a header implemented as a user control (ascx). On start-up, I
show the date/time (in a label named "lblTimer") like this:

<html>
......
<span...
<%=Now.ToShortDateString() %> - <%=ctype(Now.ToLongTimeString(),
datetime).tostring("H:mm:ss tt") %>
</span
Then, I have a JavaScript block which refreshes the clock every second - and
the main function is:
__________________________________________________ __________________________
function ClockRefresh(){

var dtDate=new Date();
var strAMPM="AM";
var intHours=dtDate.getHours();
var str = "";

str += (dtDate.getMonth() + 1) + "/";
str += dtDate.getDate() + "/";
str += dtDate.getYear();

if(intHours>12){
intHours-=12;
strAMPM="PM";
}

var intMinutes=dtDate.getMinutes() + "";
if(intMinutes.length==1){
intMinutes="0" + intMinutes;
}

var intSeconds=dtDate.getSeconds() + "";
if(intSeconds.length==1){
intSeconds="0" + intSeconds;
}

lblTimer.innerHTML=str + " - " + intHours + ":" + intMinutes + ":" +
intSeconds + " " + strAMPM;
}
__________________________________________________ __________________________

In IE everything is fine. In Mozilla, however, it starts for instance as
2/24/2005 - 1:06:48 AM
but the next second, when ClockRefresh executes, I get
2/24/105 - 1:06:49 AM

There is a 1900 years difference between the JScript getYear in Mozilla and
the one in IE !

Thank you, Alex."Alex Nitulescu" <REMOVETHIScuca_macaii2000@.yahoo.com> wrote in message
news:u54CugjGFHA.1392@.TK2MSFTNGP10.phx.gbl...

> There is a 1900 years difference between the JScript getYear in Mozilla
> and the one in IE !

Try getFullYear() instead...

http://www.quirksmode.org/js/datecompat.html
Thanks, it works fine now !

"Mark Rae" <mark@.mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%23ljNzbkGFHA.3068@.tk2msftngp13.phx.gbl...
> "Alex Nitulescu" <REMOVETHIScuca_macaii2000@.yahoo.com> wrote in message
> news:u54CugjGFHA.1392@.TK2MSFTNGP10.phx.gbl...
>> There is a 1900 years difference between the JScript getYear in Mozilla
>> and the one in IE !
> Try getFullYear() instead...
> http://www.quirksmode.org/js/datecompat.html

The JScript "getYear" does not work in Mozilla ? :-)))

Hi. I have a header implemented as a user control (ascx). On start-up, I
show the date/time (in a label named "lblTimer") like this:
<html>
.....
<span...
<%=Now.ToShortDateString() %> - <%=ctype(Now.ToLongTimeString(),
datetime).tostring("H:mm:ss tt") %>
</span>
Then, I have a JavaScript block which refreshes the clock every second - and
the main function is:
________________________________________
____________________________________
function ClockRefresh(){
var dtDate=new Date();
var strAMPM="AM";
var intHours=dtDate.getHours();
var str = "";
str += (dtDate.getMonth() + 1) + "/";
str += dtDate.getDate() + "/";
str += dtDate.getYear();
if(intHours>12){
intHours-=12;
strAMPM="PM";
}
var intMinutes=dtDate.getMinutes() + "";
if(intMinutes.length==1){
intMinutes="0" + intMinutes;
}
var intSeconds=dtDate.getSeconds() + "";
if(intSeconds.length==1){
intSeconds="0" + intSeconds;
}
lblTimer.innerHTML=str + " - " + intHours + ":" + intMinutes + ":" +
intSeconds + " " + strAMPM;
}
________________________________________
____________________________________
In IE everything is fine. In Mozilla, however, it starts for instance as
2/24/2005 - 1:06:48 AM
but the next second, when ClockRefresh executes, I get
2/24/105 - 1:06:49 AM
There is a 1900 years difference between the JScript getYear in Mozilla and
the one in IE !
Thank you, Alex."Alex Nitulescu" <REMOVETHIScuca_macaii2000@.yahoo.com> wrote in message
news:u54CugjGFHA.1392@.TK2MSFTNGP10.phx.gbl...

> There is a 1900 years difference between the JScript getYear in Mozilla
> and the one in IE !
Try getFullYear() instead...
http://www.quirksmode.org/js/datecompat.html
Thanks, it works fine now !
"Mark Rae" <mark@.mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%23ljNzbkGFHA.3068@.tk2msftngp13.phx.gbl...
> "Alex Nitulescu" <REMOVETHIScuca_macaii2000@.yahoo.com> wrote in message
> news:u54CugjGFHA.1392@.TK2MSFTNGP10.phx.gbl...
>
> Try getFullYear() instead...
> http://www.quirksmode.org/js/datecompat.html
>

the language shown in Chinese?

Hallo guys! Nice to join this forum!!

I have a question regarding ASP.NET web control. I created "Calendar" and I wrote simple code on it. Surprisingly after I run and display in IE, all the characters were in Chinese. I doubled check the control panel and set the regional and language to be all in English but all in vain. What should I do?

My second question is only for my own curiosity: After I did some changes to the language, I restart the PC and surprisingly the code window seemed to be zoom in a bit, it is now displayed in slightly larger fonts and a bit irritating.
Do you know how I could retrieve back the original font size in code window?

Thanks =)Internet Explorer > Tools > Options > Language button.

What language do you have there?
Hi, hehehe... I checked already, it was shown English (United Kingdom)...

But still cannot display correct English Calendar! Thanks!

The located assemblys manifest definition with name System.Drawing does not match the asse

I downloaded a control called ASP popup from Eeeksoft.
I then used this on my machine to create a web project. It worked fine.
The project was then literally copied to the server. The problem is that I get the following error now

The located assembly's manifest definition with name 'System.Drawing' does not match the assembly reference.

and it highlights the code for the control.
Please tell me what I am doing wrong.

JagdipSolve it. I think the problem was with version numbers.

The dll I was using was made in Framework 1.1, when I only had Framework 1.0. Luckly, I could get a copy of the dll in Framework 1.0, and the control worked fine after that.