Click here to Skip to main content
12,953,014 members (38,405 online)
Rate this:
Please Sign up or sign in to vote.
See more:
<span>Passport Type </span>
<td colspan="3">
<div class="t-widget t-dropdown t-header" tabindex="10" title="Type of passport carried by the visa applicant"><div class="t-dropdown-wrap t-state-default"><span class="t-input">&nbsp;</span><span class="t-select"><span class="t-icon t-arrow-down">select</span></span></div>&lt;input id="PASSPORType" name="PASSPORType" style="display:none" type="text" value="" /&gt;</div>
<span class="field-validation-valid" data-valmsg-for="PASSPORType" data-valmsg-replace="true"></span>
jQuery('#PASSPORType').tDropDownList({data:[{"Text":"","Value":""},{"Text":"Normal","Value":"1"},{"Text":"Diplomatic","Value":"2"},{"Text":"Special","Value":"3"},{"Text":"Hajj Cert","Value":"4"},{"Text":"Travel Cert","Value":"5"}]});
    <script src="/Scripts/jquery-ui-1.8.23/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>

I want to send values to dropdown list on website which is open in webbrowser control but it can not done by
webBrowser1.Document.GetElementById("VisaKind").InnerText = "Special"

so what will i do ...kindly help me thanks in advance
Posted 18-Feb-13 2:41am
Updated 18-Feb-13 2:43am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have a suggestion. But i don't know that it solve your problem. You should try and see.

I think you may send dropdownlist data as xml with http post. And you shold get this data than set your dropdown list.

look at google for more info like this: sending xml data over http.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

this code
webBrowser1.Document.GetElementById("DateTimePicker").InnerText = "1/1/2013"
is also working for date although it contain same script and jequery but it is not working for dropdownlist.....
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


here the solution to our problem (I'm working on the same project - Saudi Arabia Visas. My Software was working with old site and now I'm updating. It's really cool.)

Here's some functions

- Import directly the picture from the scanner with the correct size.
- Import data from invitation letter (Name,Nationality, SponsorName, SponsorAddress, SponsorId etc etc) and fill the form automatically.
- Print Visa Form
- Back up in a db all the passport data, so the next visa you don't have to write again (Passport Number, expire, residence, and so on)
- It translates the invitation letter from arabic.

That's just a look, but it does a lot more. :)

But... let's come back to our problem....I've spent all night long to solve it but in the end it's done :)

I've decided to inject a function to change all the DropDownList value.

webBrowser1.Document.InvokeScript("eval", New String() {"function ImpostaDrop(Lista,Valore) { var dropDownList = $(Lista).data('tDropDownList');;  }"})

And when I need to change a value here's the VB Code.

WebDocument1.Document.InvokeScript("eval", New String() {"ImpostaDrop('#VisaKind',2)"})

It works great !!! :D

I'd like to see your software running. Let's keep in touch !!

Alex from Italy
shekomero 26-Mar-14 11:49am
i am interesting in above code, i have troubles converting this to .. any help?
alexpalmieri 9-Nov-14 6:30am
Sorry for my late, didn't notice your question.
Hope you've solved meanwhile. The code above is already in What's your problem ? You have a web control named WebBrowser1 loaded with the page. On the eventWebBrowser1_DocumentCompleted you have to use the code

webBrowser1.Document.InvokeScript("eval", New String() {"function ImpostaDrop(Lista,Valore) { var dropDownList = $(Lista).data('tDropDownList');; }"})

This inject a Javascript function on the page that will change the value of DropDown. You can call this function from Vb.Net using this code.

WebDocument1.Document.InvokeScript("eval", New String() {"ImpostaDrop('#VisaKind',2)"})

Where #VisaKind is the name of the dropdown and 2 is the value to set. This is a workaround and it does its job :) If you need more help you can find me at
Jawad Ahmed Tanoli 12-Nov-14 10:39am
Great Work Alex :) actually due to requirement change we used to get data from website using webbrowser by putting a button on webbrowser control when the user fill all form press the button and get all data to store in to database and for further process this project still running good.
which may be like this string visakind= webBrowser1.Document.GetElementById("VisaKind").GetAttribute("value");
alexpalmieri 12-Nov-14 18:45pm
Why don't you intercept the Save button on the original web page ? It's the best way. What if your user forget do click on your button and go and save directly the page. You'll loose record. The solution I've adopted save the data when user click on the original button and then send data. A sort of man in the middle. I save all the data in a database and have it for the next time. It takes the first data directly from the invitation letter and the rest from the database. So you can fill the form in 1 minute and without error :)
Hope my job helped you. The VisaKind dropdown and other as you've seen are from telerik and not standard one. So we need to use that workaround to set and read from that dropdown list :)
Let me know if I can help you more. My email is
Have a good day :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,389
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 8 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100