this is my first thread..hope i return satisfied..
i am a newbie in asp ,net...i want urgent help...
the following snippet i am going to present was copied from some where though it works perfectly fine...i jst want to change its functionality a bit..............its basically a drop down box...i want that whatever number i choose ie 1 2 3 ...i get 100,200,300 resp in my label11.text...the code i got uses return alert ...instead of return alert i want the value to be displayed in drop down box....the foll code is

<select id="dropdown" onchange="storeVal(this,'hiddenVal');">
<option value="default">--Select no. of seats--</option>
<option value="A">1</option>
<option value="B">2</option>
<option value="C">3</option>
<option value="D">4</option>

<input type="hidden" id="hiddenVal" />

<script type="text/javascript">

function storeVal(selectObj,id)

    var hiddenObj = document.getElementById(id);
    var optionArr = selectObj.getElementsByTagName("option");

    if (selectObj.value == "default") return false;

    for (i=1; i<=optionArr.length; i++)
        if (selectObj.value == optionArr[i].value)
            hiddenObj.value = i;

 return alert('Your total cost is Rs.' +100* i + '');




hope to get early answers...

insert text box in form and create one variable of type string just giving idea


return alert('Your total cost is Rs.' +100* i + '');


int  value = 100 * i;
            string str =Convert.ToString  ("Your total cost is Rs" + value );
            textBox1.Text = value.ToString();

tested by me
if ok with u dont forgate to click on solved

hey thnx 4 ur concern nd help...tried the code bt there is no effect on text box...it remains unchanged....is dis coz i m tryin dis code in html page nd nt in .cs page...pls helppp.............

just do googling how to use this code in html cose yet i dont work on html so try on ur please sorry for this time but logic is working so apply same logic ok

kk...thnx..bt wen im tryin di in c#..den it is giving error in

function storeVal(selectObj,id)...dis line...jst temme wher e u wrote d code...bt thnx nyways...4 ur help..

actualy dear m quite busy with work so right now dont have bit time to understand and solve ur problem sorry for that but try after finnishing work ok u also try your own and never use small words like" 4 ur dis " in this comunity becose admin will give you warning and dwduct your Raputation Point k so take care of that


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.