I'm trying to get my function to display a value or make a label visible once you select a certain value from the dropdown thats in my datagrid. Is there a way to do this
Any help would be appreciated.
<script language="javascript" type="text/javascript">
function OnChange()
{
var IndexValue = document.getElementById('<%=myDataGrid.ClientID %>').getElementsByTagName(".selectedIndex;
var SelectedVal = document.getElementById('<%=myDataGrid.ClientID %>').options[IndexValue].text;
alert(SelectedVal);
}
//-->
</SCRIPT>
<asp DataGrid ID="myDataGrid" runat="server" AutoGenerateColumns="False"
BackColor="AntiqueWhite" BorderColor="Black" CellPadding="3"
Font-Name="Verdana" Font-Names="Verdana"
Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
Width="909px" DataSourceID="SqlDataSource1"
onselectedindexchanged="myDataGrid_SelectedIndexChanged">
<HeaderStyle BackColor="Maroon" ForeColor="White" />
<Columns>
<asp:TemplateColumn HeaderText="Select Action">
<ItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" onchange="javascript:OnChange(this);" Enabled="True">
<asp:ListItem Value ="0" >Select an Action</asp:ListItem>
<asp:ListItem Value ="1" >Drop</asp:ListItem>
<asp:ListItem Value ="2" >Change</asp:ListItem>
</aspropDownList>
</ItemTemplate></asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Term">
<ItemTemplate>
<asp:Label ID="Term" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "STRM") %>' />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp DataGrid>
Any help would be appreciated.
<script language="javascript" type="text/javascript">
function OnChange()
{
var IndexValue = document.getElementById('<%=myDataGrid.ClientID %>').getElementsByTagName(".selectedIndex;
var SelectedVal = document.getElementById('<%=myDataGrid.ClientID %>').options[IndexValue].text;
alert(SelectedVal);
}
//-->
</SCRIPT>
<asp DataGrid ID="myDataGrid" runat="server" AutoGenerateColumns="False"
BackColor="AntiqueWhite" BorderColor="Black" CellPadding="3"
Font-Name="Verdana" Font-Names="Verdana"
Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
Width="909px" DataSourceID="SqlDataSource1"
onselectedindexchanged="myDataGrid_SelectedIndexChanged">
<HeaderStyle BackColor="Maroon" ForeColor="White" />
<Columns>
<asp:TemplateColumn HeaderText="Select Action">
<ItemTemplate>
<aspropDownList ID="DropDownList1" runat="server" onchange="javascript:OnChange(this);" Enabled="True">
<asp:ListItem Value ="0" >Select an Action</asp:ListItem>
<asp:ListItem Value ="1" >Drop</asp:ListItem>
<asp:ListItem Value ="2" >Change</asp:ListItem>
</aspropDownList>
</ItemTemplate></asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Term">
<ItemTemplate>
<asp:Label ID="Term" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "STRM") %>' />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp DataGrid>