Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2007, 01:53 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

That should work, but what happens when you implement that code?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 02:13 PM
Authorized User
 
Join Date: Dec 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no change in the behavior of my custom control.It works exactly the same.

Do you think i need to add something in the javascript for Enter(keycode==13) or for postback??

Thanks
Kamal

 
Old February 16th, 2007, 02:24 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

have you set the autopostback property of the control to true?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 02:26 PM
Authorized User
 
Join Date: Dec 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes. Positively.Here is the code .

<cc1:SmartDropDown id="SmartDropDown1" style="Z-INDEX: 102; LEFT: 132px; POSITION: absolute; TOP: 182px" runat="server" Width="159px" AutoPostBack="True" Height="38px">

 
Old February 16th, 2007, 02:35 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Have you specified in your code when those methods above are to be triggered and by which action triggers those events?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 02:37 PM
Authorized User
 
Join Date: Dec 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I dont understand ...you mean in Custome control ?

 
Old February 16th, 2007, 02:39 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Give me a bit ill write a solution to this.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 02:42 PM
Authorized User
 
Join Date: Dec 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No problem. Let me know if you need any information from my side.

Thanks a ton.You are so kind.
Kamal

P.S. I am still trying though.

 
Old February 16th, 2007, 03:18 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

After looking at the source of that control you are using, there is nothing in the JavaScript that I can see raises the postback event.

Do you have a method in your code behind that is handling the postback?

Something like:
    Private Sub drp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drp.SelectedIndexChanged
        'do something
    End Sub

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 03:26 PM
Authorized User
 
Join Date: Dec 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

protected string GetScriptBlock(string clientID)
        {
                StringBuilder sb = new StringBuilder();

                sb.Append("<SCRIPT lang='JavaScript'>");
                sb.Append(" var typeAheadInfo = {last:0, currentString:'', delay:20000, timeout:null, reset:function() {this.last=0; this.currentString=''}};");
                sb.Append(" function typeAhead(ctrl) {");
                sb.Append(" if (window.event && !window.event.ctrlKey) {");
                sb.Append(" var now = new Date();");
                sb.Append(" if (typeAheadInfo.currentString == '' || now - typeAheadInfo.last < typeAheadInfo.delay) {");
                sb.Append(" var myEvent = window.event;");
                sb.Append(" var selectElement = myEvent.srcElement;");
                sb.Append(" var keyCode = myEvent.keyCode;");
                // The NumPad returns slightly differant keyCodes then the numbers on the type of the keyboard.
                // If we subtract 48 it will return the correct keyCode.
                sb.Append(" if (keyCode >= 96 && keyCode <=105) {");
                sb.Append(" keyCode = keyCode - 48;");
                sb.Append(" }");
                //this traps the enter, and causes a post back
                sb.Append(" if (keyCode == 13) {");
                sb.Append(" __doPostBack('" + clientID + "','');");
                sb.Append(" }");

                sb.Append(" var newChar = String.fromCharCode(keyCode).toUpperCase();");
                sb.Append(" typeAheadInfo.currentString += newChar;");
                sb.Append(" var selectOptions = selectElement.options;");
                sb.Append(" var txt, nearest;");
                sb.Append(" for (var i = 0; i < selectOptions.length; i++) {");
                // change this from .text to .value to use the value of the item instead of the visual text if desired
                sb.Append(" txt = selectOptions[i].text.toUpperCase();");
                sb.Append(" nearest = (typeAheadInfo.currentString > txt.substr(0, typeAheadInfo.currentString.length)) ? i : nearest;");
                sb.Append(" if (txt.indexOf(typeAheadInfo.currentString) == 0) {");
                sb.Append(" clearTimeout(typeAheadInfo.timeout);");
                sb.Append(" typeAheadInfo.last = now;");
                sb.Append(" typeAheadInfo.timeout = setTimeout('typeAheadInfo.reset()', typeAheadInfo.delay);");
                sb.Append(" selectElement.selectedIndex = i;");
                sb.Append(" myEvent.cancelBubble = true;");
                sb.Append(" myEvent.returnValue = false;");
                sb.Append(" return false; ");
                sb.Append(" }");
                sb.Append(" }");
                sb.Append(" if (nearest != null) {");
                sb.Append(" selectElement.selectedIndex = nearest;");
                sb.Append(" }");
                sb.Append(" } else {");
                sb.Append(" clearTimeout(typeAheadInfo.timeout);");
                sb.Append(" }");
                sb.Append(" typeAheadInfo.reset();");
                sb.Append(" }");
                sb.Append(" return true;");
                sb.Append(" }");
                sb.Append(" </SCRIPT>");
                return sb.ToString();
        }

This is my java script.If you will notice it says that if keycode==13 then do _doPostBack.
And then there is code on drp_SelectedIndexChanged but that just populates datagrid and other fields.

Other than that i dont have much.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting ahead of IDataReader? technimedia BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 July 31st, 2007 11:34 AM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 6 March 18th, 2005 03:32 AM
Drop Down List Beginner123 VB How-To 2 March 7th, 2005 01:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.