LITERAL control containing html SELECT control - how can I get events ?

on a web page written in VB.NET , I have a literal control  created. It's contents is :

Literal1.Text = " <select name=""addselect"" id =""addselect"" style=""width=100%"" size=""2"" maxlength=""27"" runat=server " & _
" onclick=""__doPostBack(" & _
"'addselect','')"" " & _
" language= ""javascript""> " & _
" <optgroup label=""Owner""> " & _
" <option selected><font size=""2"" face=""Arial, Helvetica, sans-serif"" color=""#004080""> " & _
" Owner 1
</font></option>" & _
" </optgroup> <optgroup label=""Agent""> " & _
" <option><font size=""6"" face=""Arial, Helvetica, sans-serif"" color=""#004080"" >Agent1 " & _
" </b></font></option>" & _
" <optgroup label=""Applicant""> </optgroup> <optgroup label=""Solicitor""> " & _
" </select>"

This let's me use a dropdown box with the OPTGROUP tag (required), runat=server & autopostback (used script to trigger the "_doPostBack" function) on my form.
This is all very nice but it leaves me with 1 problem. I don't know the code required to :
- raise an event in the code behind page when the select box is clicked
- handle the event
- determine which value was selected in the select box
Anyone know how to do this in VB.NET ?
0
DURHAM
9/26/2003 8:22:17 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

0 Replies
940 Views

Similar Articles

[PageSpeed] 41

Reply:

Similar Artilces:

How to access individual controls from a form containing the web user control containing those controls
 Below is a block of code in my .aspx form named default.aspx. In this form I load a web user control. I then add it to a place holder control.(Lines 3 and 4 below) So how do I access the individual controls in my web user control? I want to set the properties on those controls, but I am baffled as to how to access the control. For example I have a text label control named "label3". How do I access this control. Because for example, under certain situations I want to hide that control. ( Label3.Visible = false;)  1    if(!Page.IsPostBack) 2&nb...

Is there any web form control that can work as IFRAME html control?????
in html pages, we can use iframe control in which we can load another pages and/or folder explorer. now, i'm developing a web page in which i like to show the folder explorer when user clicks a link. as a prototype, i developed an html page like below: <html> <head><title>Using iFrame to browse a folder</title> </head> <body bgcolor=cyan> <table left=5px top=5px id=tabMain width=90% height=90% border=1 cellspacing=1 cellpadding=1> <tr height=100%> <td width=20% align=center valign=middle> <INPUT TYPE="Butto...

Web form Controls vs HTML controls
Hi, can anyone explain me the difference between Web Form Controls and HTML controls? What is their usability and disadvantages? Can i write code behind HTML controls?    Thanx in advance. Yes, you just have add "runat=server", in your HTML control. The Web Server Control, have more funtionality that the HTML controls. With Web Server Control, you can work easy with Data. Too, you have controls as AdRotator, WebCalendar and more... : http://samples.gotdotnet.com/quickstart/MCP Sergio Tarrillo Here are the Recommendations from Microsoft ....when to use 1 over the other...

HTML Controls vs Web Form Controls
Hi, I have a page with both controls (HTML and Web Form Controls). I am trying to use an html Calendar control and then get the date selected by the user and put into a Web form input field control. When I try to run this the HTML control cannot talk to the Web form control. Any ideas? Thanks. Can't you put some javascript in the HTML-control with which you assign the value to the ASP.NET Server control? Please post some code so I can help u. Kind Regards,ThaYoung1! Hi here is the Code. Also I added a web form text input control and an html text control and created a fu...

can view only HTML control but no Web Control
I am new at Asp.net world... while running in my local host it is fine but after uploading only HTML stuffs are showing not the asp ones. Please help!!   Thanks, RUMANArumana Can you provide us with more details? If the server wasnt running the ASP.Net compiler, it wouldn't even show you the page. Did you save the page with a html/htm extension?    So simple... yet so effective.My "Life"ly Blog...

Is there an HTML container similar to the literal control which can contain images?
I'm using FreeTextBox to gather input from the user which may contain images.  I'm then storing the HTML generated by FreeTextBox in a database.  I need to be able to retrive the HTML at runtime and render it on the page at a specified location.  The literal control works fine for formated text but will not show images.  Is there another control similar to the literal control that will accept images? The literal control should be able to display images - or anything. I bet is has something to do with the url for the image. What if you do a view source on the gen...

Getting the Selected Item of dropdownlist inside Web User Control on a Web Form
Ive got a dropdownlist control inside a web user control called Entity.ascx. This web user control is on a webform.aspx. In Entity.ascx class I created a SelectedEntity property that returns the selected item in the dropdownlist. Inside webform.aspx when btnGo is pushed I set a string and pass it in the url. I am trying to get the entity they selected via the property (SelectedEntity) inside Entity.ascx. As the SelectedEntity property tries to return the selected item in the dropdownlist I get this error: System.NullReferenceException: Object reference not set to an instance...

Web Form Server Controls Vs. HTML controls
Hi1. What is the difference between Web Form Server controls and HTML controls with runat="server" attribute.e.g. <input type="text" id="mytext" runat="server"> Vs. <asp:TextBox id="mytext" />2. Why we should not use the normal HTML control instead of Server Controls since HTML controls are rendered on client side the performance in using them will be much better that using Web form server controls. Pls. can somebody explain this.- Anand one thing i know. there are much more options for the web controls. and web controls are easier to use than the http controls. for exampl...

Controlling web control instances on Web Form
I have created a composite control, extending functionality of the Hidden Control. However, I would like to prevent the user from adding this control to the page multiple times. I only want one instance of the control on the Web Form. What setting in my project to I adjust to enable this functionality? I can not find it in any of the books that I have referenced. Is this a setting or is this code that has to be added to the inheriting class. Looks like there is no standard apporach. But I'd consider using static field to count number of created objects and throw exception if second object ...

How to get HTML control data from a web form
May sound simple but having trouble with this.  I'm dynamicly building a table and want to have a check box in each row.  I'm rendering the check box as an HTML control not an asp:CheckList.  How do I get the data from the HTML control?  Example: string prefixName, group, model;while (Reader.Read())            {                group = Reader["model_group"].ToString();          ...

html control and web control
Hi i am getting confused when i should use html controls and when i should use web controls. Any ideas? Cheers.I can do it! if you need any server side programability or events then user Web. If you want pure HTML then use HTML controls.... Is there anything in particular you are confused about? Here are a few things to consider:It's a tough question to answer without knowing the specifics of your application.HTML controls do not have as many features with their web server control counterparts.HTML controls could be a good idea if you were converting some existing web pages that used ...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

How do you expose an event from a server control within an user control on an web form?
I have a calendar inside of an user control Simple.ascx The user control is sitting on my web form Simple.aspx. How do I access the VisibleMonthChanged event from my web form Simple.aspx? Is it possible? Yes Create Event in usercontrol which fires on page when VisibleMonthChanged event fires on usercontrol. Jigar Desai-----------------------Do not forget to "Mark as Answer" on the post that helped you. Ok, I created the event Public Event MonthChanged() in Simple.ascx.vb. Then I add the follow to Simple.aspx.vb Private Sub Simple_MonthChanged() Si...

how can i Fill the controls on web page by selecting value from dropdownlist control.
  Hi,  Currentlly i am working on a web application where i require to fill the web form with the selected item in a text box. for example i have dropdown control named supplier_name, and i want to fill all the other controls values from database on the form when i select name from that supplier_name box,i.e , if i select name1, then related to that name, its code,address ,city should appear on related text boxes. I have done the same in windows application with c# , but the problem with web application(asp.net) is that, when i select Supplier _ it...

Web resources about - LITERAL control containing html SELECT control - how can I get events ? - asp.net.web-forms

The New York Times
For decades, aspiring bomb makers — including ISIS — have desperately tried to get their hands on a lethal substance called red mercury. There’s ...

Melania Trump: My modeling career shouldn't matter in Donald's presidential run
Republican presidential front-runner Donald Trump said his wife, Melania, would be a “beautiful” and “elegant” first lady. In an interview with ...

Ben Carson Becomes Last Major Candidate to File for New Hampshire Primary
NBCNews.com Ben Carson Becomes Last Major Candidate to File for New Hampshire Primary NBCNews.com CONCORD, N.H. Ben Carson strolled through ...

Black Friday: Sony Xperia Z5 deal: Save £99 on the James Bond phone with BLAFRIZ5
It's not just Mobiles.co.uk and Carphone Warehouse that have gone early with their Black Friday phone deals. Mobile Phones Direct is also getting ...

Navy Aircraft Carrier Makes Awesome Star Wars: The Force Awakens Trailer Spoof!
The force is strong with the crew of the super carrier USS Dwight D. Eisenhower (CVN-69) and Carrier Air Wing Seven, as you can tell by the fantastic ...

Tesla Model S Recalled Over Potential Seat Belt Malfunction
The Tesla Model S is currently being recalled by the company . Apparently it seems that there is an issue with the car’s front seat belt that ...

Facebook CEO Zuckerberg to take two months of paternity leave
By Yasmeen Abutaleb SAN FRANCISCO (Reuters) - Facebook Inc Chief Executive Officer Mark Zuckerberg said on Friday he will take two months of ...

Man Freed After 3 Decades in Prison Vows Never to Return
Montana man granted clemency after 3 decades behind bars leaves prison, vows never to return

Appeals Court Hears Arguments in DC Gun Law Case
Appeals court hears arguments in DC gun case, city attorney argues judge overstepped authority

Rachel Weisz Teaches Jimmy Fallon How to Properly Pronounce Michael Caine
Rachel Weisz is gorgeous in red while making an appearance on The Tonight Show Starring Jimmy Fallon on Thursday (November 19) in New York City. ...

Resources last updated: 11/21/2015 9:18:07 AM