3
Reply

Programmatically adding javascipt code in c#

Sezgin Zeka

Sezgin Zeka

Mar 11 2010 9:43 AM
2.3k
I have a serious problem with adding javascript event programmatically.

   protected override void Render(HtmlTextWriter writer)
        {
            Attributes.Add("onkeypress", "WebEnumComboBox_OnKeyPress_" + ClientID + "(event)");
            Attributes.Add("onkeyup", "WebEnumComboBox_OnKeyUp_" + ClientID + "(event)");
            base.Render(writer);
        }


is my code, if i wrote this code, mycombobox does not see both events in clientside. Bu if i change
" Attributes.Add("onkeyup", "WebEnumComboBox_OnKeyUp_" + ClientID + "(event)");"

to

 "Attributes.Add("onkeydown", "WebEnumComboBox_OnKeyDown_" + ClientID + "(event)");"

it works but, working one does not match my needs. The other (not working) one match. Please help, i want the non working one working but how?
 

Answers (3)