另外,您可以查看有关如何检查文本的.NET文章框中包含一个数字,以获取如何在.NET中使用JavaScript的示例。 干杯! -FrinnyAre you sure you want to use JavaScript instead of Server Side code to populate the TextBox?There is a way to do it using JavaScript but it''d be easier to do with Server Side code....You''d have to write a JavaScript that handles the onblur event for the DropDownList (which is an HTML <select> list) that takes the selected value and sets the TextBox''s text (set the "value" property of the <input type="text"> element that is your TextBox)If you really want to do this....I''d start my research on the w3c website...it has good examples and I have found it to be the best resource for JavaScript problems.Also, you could check out the .NET article on How to check if a textbox contains a number for an example of how to use JavaScript in .NET.Cheers!-Frinny是的,我能够在服务器端使用C#,但是我必须单击提交按钮才能获得填充文本框的文本。我希望能够在下拉列表中选择不同的选项并让它填充文本框。 Mayb我做错了吗?就像这样...Yeah, I was able to get it working with C# on server side, but I had to click the submit button to get the text to populate the text box. I wanted to just be able to select the different choice in the dropdownlist and have it populate the text box. Mayb I did it wrong? It was like this... 展开 | 选择 | Wrap | 行号您不必使用提交按钮来执行此操作。 你需要做的就是设置DropDownList'的'autoPostBack" property to true ...这将导致DropDownList在所选索引发生更改时回发到服务器。 然后你编写的代码将TextBox中的文本更改为DropDownList在处理所选索引更改的方法中选择的值(或其他)。 但是这个解决方案仍然使用ServerSide代码来解决问题。 这些链接对你有帮助吗? -FrinnyYou shouldn''t have to use a submit button to do this.All you need to do is set the DropDownList''s "autoPostBack" property to true...this will cause the DropDownList to postback to the server whenever the selected index changes.Then you write the code that changes the text in your TextBox to be that of the DropDownList''s selected value (or whatever) in the method that handles the selected index change.But this solution is still using ServerSide code to solve the solution.Did those links help you at all?-Frinny 是的,我是能够在服务器端使用C#,但我必须单击提交按钮以获取文本填充文本框。我希望能够在下拉列表中选择不同的选项并让它填充文本框。 Mayb我做错了吗?就像这样...Yeah, I was able to get it working with C# on server side, but I had to click the submit button to get the text to populate the text box. I wanted to just be able to select the different choice in the dropdownlist and have it populate the text box. Mayb I did it wrong? It was like this... 展开 | 选择 | Wrap | 行号 这篇关于客户端从asp.net下拉列表中处理selectedIndexChanged的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 05:29
查看更多