Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Monday, March 26, 2012

MutuallyExclusiveCheckBoxExtender doesnt work if elements are added dynamically

I create my table on the fly and added checkboxes as well as MECBextenders.

The client script is not working on the page. It works as expected if the MECBs are added during design time.

Here is some code to demonstrate population:

1string extenderKey ="AllTheSameKey";23foreach (MvpPoint pointin _selected.FolderPoints)4 {5678switch (point.PointType)9 {10case tPointType.DO:11case tPointType.CP:12 {13continue;14 }15default:16 {17 trow =new TableRow();1819 CheckBox chkSelected =new CheckBox();20string sPointId = point.Handle.ToString();21 chkSelected.ID ="chk" + sPointId;22 chkSelected.Visible =true;23if (point.PointType == tPointType.AI)24 chkSelected.Enabled =true;25else26 chkSelected.Enabled =true;2728 AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender chkExtender =new AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender();29 chkExtender.ID ="chkExt" + sPointId;30 chkExtender.TargetControlID = chkSelected.ID;31 chkExtender.Key = extenderKey;32

The problem ONLY exists if the MutuallyExclusiveCheckBoxExtender is cointeined inside a TabPanel. The IDs get changed by the cointeiner control and the jscript fails to find them.

Saturday, March 24, 2012

Namespace for client side Postbacks

Does anybody know what the Ajax namespace for implementing a clientside (javascript) postback is? Ideally I would like to fire a partial postback event to an update panel, pass in some arguements and then capture the event in the codebehind.Did you ever find an answer to your question? I've been looking for the same thing without any success. Every example I find is all about doing things on the client side nothing about the server side using .Net AJAX.

nope. It seems that there is no direct method to call a postback from JS. I find people asking for it all over the place though, so I would hope that MS includes it in the next version.

The work around is pretty good though. You basically have two options, I use option #1.

1) Set a hidden field as a trigger. Through JavaScript, update the value of the hidden field. This causes the Ajax postback as desired.

2) I have read about people placing a "submit" button in a hidden DIV and setting that as the trigger. Again, you submit the button via JS.

Let me know if you get stuck and I can send you code.


Thanks for your reply, actually I'm trying to write a control that uses the UpdatePanel. I wrap my control in it and I've tried adding some buttons to the triggers collection, but when I click the button it performs a normal postback. Is there anything special you've found that needs to be done for something like this to cause an ajax postback? What I'm doing here sounds kind of like your second suggestion, but it doesn't seem to work.

Anything INSIDE an Update panel should cause only an "Ajax" postback, and that includes other controls. Make sure you have the attribute Updatemode set to conditional. Like so:

<

asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="conditional">

Naming Convention to search for a control with $get

Is there another way to find a control when using a master page and a tabContainer ?

For now I'm using the following syntax in Ajax client script:

$addHandler($get("ctl00$myContentPlaceHolder$myTabContainer$myTab1$txtPostalCode"), "keyup",mapPostalCode);

It's a little long, no ??

Thank you !

Gerrie

I usually embed the control.ClientID in a javascript variable if I need it, like so:

var txtPostalCode = "<%= txtPostalCode.ClientID %>";

Note this only works (afaik) inside on-page script tags or in an embedded .js file (from an assembly), or in a registered script block.


Great!

$addHandler($get("<%= txtPostcalCode.ClientID %>"),"keyup", mapPostalCode);

it works !!!

Thanks for this little annoying problem... sometimes little things keep me awake :-)

Need a double check on my options

I am not familiar with client side scripting.

My situation involves dynamic validation and masking of an asp.net textbox.

From reading articles and knowing what I think I know about server control, the only way to accomplish this is by using a client side raw javascript or using the new atlas clientside scripting functionality.

Just for verification, It is not possible to do it with just a server control, right?

Thanks for any input...

You could do it server-side but it would be an unberably bad user-experience. Any field masking should happen client side, and validation should happen on client and server side.

You usually do validation client sideand server side.

Masking involves the use of javascript. You need javascript to add and control the mask on the input element.

By the way, I am using the prototype version of MaskEdit control. It's included in the source code of Atlas Control Tookit.

It's very nice!

Cheers,

Leo


I will try the new control, thanx for the info.

One last question,

This is for a telephone number. I want to be able to mask on the insert template and display on the item template with the format (000) 000-0000.

The question is would you store it in the db as a nchar with formatting or as an integer and add and remove formatting on the server side?

Jamy

need a soap tools

dear sir,

I want to know which tools can be used to catch soap inforamtion? I used tcpmonitor, but it is better when client and server at differnt host.

thanks

SOAPSonar is an excellent tool and they have a free version that you can download.

need help about socket programming

hello ,

I tried to create client-server based web site including two page, webserver page is behaves as a server and webclient page as a client of this server..

I try to listen and accept to all clients wants to connect to the server when server page is loading.. but while it begun to listening for client pages, execution of server goes to slow then my server page couldn't open..

I also checked this codes in vb.net ad c# net ,it work correctly.

do you have any idea where can I download a good socket connection sample for asp.net?. I found code written for vb.net or c# desktop applications but I am not able to run this codes in asp.net..

Thank you in advance

im looking for something similar, have u had any luck?

hi aal27

i couldn't find anythin,g i thougth there is no chance to todo this...

send me a message if you find something useful

Wednesday, March 21, 2012

Need information on Preview scripting

It seems that a lot of client side script was moved to Preview part. Is there any documentation what is in preview and some examples?

Second question:

How do I get $get for server side controls? Let say TextBox with server side id="textName" may have very long name on a client. Is there a way to get hold of that control using it server ID?

Thanks

Answer for first question I figured out.

$get('<%=textName.ClientID%>)

For second I found

http://www.asp.net/downloads/futures/

But I still don't see any client script reference, like where is Sys.Preview.UI.TextBox information.

Thanks


Hi,

I think you've found the answer to your second question. That's : $get('<%=textName.ClientID%>)

The generated client ID can be got in the way like your code.