Click here to Skip to main content
15,893,622 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Problem with mage tag Pin
Enver Maroshi27-Jun-09 3:50
Enver Maroshi27-Jun-09 3:50 
AnswerRe: Problem with mage tag Pin
Abhijit Jana27-Jun-09 3:58
professionalAbhijit Jana27-Jun-09 3:58 
GeneralRe: Problem with mage tag Pin
renjithmp27-Jun-09 9:33
renjithmp27-Jun-09 9:33 
Questionhow to check Pin
KhandelwalA27-Jun-09 2:04
KhandelwalA27-Jun-09 2:04 
AnswerRe: how to check Pin
Abhijit Jana27-Jun-09 2:46
professionalAbhijit Jana27-Jun-09 2:46 
QuestionGet value from javascript function into Dropdown and Display selected Value Pin
.NET- India 27-Jun-09 2:01
.NET- India 27-Jun-09 2:01 
AnswerRe: Get value from javascript function into Dropdown and Display selected Value Pin
padmanabhan N27-Jun-09 2:08
padmanabhan N27-Jun-09 2:08 
GeneralRe: Get value from javascript function into Dropdown and Display selected Value Pin
.NET- India 27-Jun-09 2:15
.NET- India 27-Jun-09 2:15 
This is my javascript function
function myFunc()
{
if(document.getElementById("ddlCountry").value=="India")
{
//Remove Existing Values
var e=document.getElementById("ddlState");
while(e.firstChild)
{
e.removeChild(e.firstChild);
}
var myArray=new Array(2);
myArray[0]="Delhi";
myArray[1]="Mumbai";


for(var i=0;i<myArray.length;i++)
{
//Option(Text,Value)
e.options[i]=new Option(myArray[i]);
}

}
else if(document.getElementById("ddlCountry").value=="America")
{
//Remove Existing Values
var e=document.getElementById("ddlState");
while(e.firstChild)
{
e.removeChild(e.firstChild);
}

var myArray=new Array(2);
myArray[0]="Washington";
myArray[1]="LA";


for(var i=0;i<myArray.length;i++)
{
//Option(Text,Value)
e.options[i]=new Option(myArray[i]);
}
}

}

This is my .aspx code
<asp:DropDownList ID="ddlCountry" runat="server" onchange="myFunc(this)">
<asp:ListItem Text="Select Country" Value="Select Country"></asp:ListItem>
<asp:ListItem Text="India" Value="India"></asp:ListItem>
<asp:ListItem Text="America" Value="America"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlState" runat="server">
</asp:DropDownList>

This is my Code-Behind(on button click event) code
string name = ddlCountry.SelectedItem.Text+","+ddlState.SelectedItem.Text;
Label1.Text = name.ToString();

And ddlState.SelectedItem.Text getting null that's why that's throwing error
GeneralRe: Get value from javascript function into Dropdown and Display selected Value Pin
padmanabhan N27-Jun-09 2:29
padmanabhan N27-Jun-09 2:29 
GeneralRe: Get value from javascript function into Dropdown and Display selected Value Pin
nitin_vatsus28-Jun-09 8:37
nitin_vatsus28-Jun-09 8:37 
Questionado.net Pin
naveen attri27-Jun-09 1:41
naveen attri27-Jun-09 1:41 
AnswerRe: ado.net Pin
padmanabhan N27-Jun-09 1:55
padmanabhan N27-Jun-09 1:55 
AnswerRe: ado.net Pin
Abhijit Jana27-Jun-09 2:42
professionalAbhijit Jana27-Jun-09 2:42 
QuestionStrored procedure help Pin
paypony27-Jun-09 1:27
paypony27-Jun-09 1:27 
AnswerRe: Strored procedure help Pin
Member 387988127-Jun-09 1:30
Member 387988127-Jun-09 1:30 
GeneralRe: Strored procedure help Pin
paypony27-Jun-09 1:32
paypony27-Jun-09 1:32 
GeneralRe: Strored procedure help Pin
Member 387988127-Jun-09 1:38
Member 387988127-Jun-09 1:38 
AnswerRe: Strored procedure help Pin
padmanabhan N27-Jun-09 1:33
padmanabhan N27-Jun-09 1:33 
GeneralRe: Strored procedure help Pin
paypony27-Jun-09 1:37
paypony27-Jun-09 1:37 
GeneralRe: Strored procedure help [modified] Pin
padmanabhan N27-Jun-09 1:42
padmanabhan N27-Jun-09 1:42 
GeneralRe: Strored procedure help Pin
paypony27-Jun-09 1:59
paypony27-Jun-09 1:59 
GeneralRe: Strored procedure help Pin
Abhijit Jana27-Jun-09 2:25
professionalAbhijit Jana27-Jun-09 2:25 
GeneralRe: Strored procedure help Pin
padmanabhan N27-Jun-09 2:32
padmanabhan N27-Jun-09 2:32 
GeneralRe: Strored procedure help Pin
paypony28-Jun-09 19:28
paypony28-Jun-09 19:28 
QuestionModalpopup extender in IE Pin
Member 387988126-Jun-09 22:50
Member 387988126-Jun-09 22:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.