favaboy
12-29-2004, 03:26 AM
Hi to all,
I've a problem... this is the situation:
In a Datagrid I have a column reporting an ID in a control Label
<asp:TemplateColumn Visible="False">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:Label id="lblID" runat="server" EnableViewState="True" Visible="False" >
<%# DataBinder.Eval(Container.DataItem, "ID") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
Then, in the last column of the datagrid, I've a dropdownlist, reporting interval values
as ListItem... let's say:
<asp:TemplateColumn HeaderText="Grafico">
<ItemTemplate>
<asp:DropDownList id="MonthDropDown" AutoPostBack="True" Runat="server" CssClass="combos" OnSelectedIndexChanged="ddlMese_SelectedIndexChanged">
<asp:ListItem Value="1">1 Mese</asp:ListItem>
<asp:ListItem Value="3">3 months</asp:ListItem>
<asp:ListItem Value="6">6 months</asp:ListItem>
<asp:ListItem Value="12">12 months</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
*****************************
The problem is, that I've to redirect the user to another page when he selects a value
in the dropdownlist, also bringin the ID of the first field.
In codebehind I use:
Protected Sub ddlMese_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim ddlMonth As DropDownList = CType(sender, DropDownList)
Dim dgi As DataGridItem = CType(ddlMonth.Parent.Parent, DataGridItem)
Dim ChoosenMonth As DropDownList = CType(dgi.FindControl("MonthDropDown"), DropDownList)
' this one should contain the value but it's always empty!!! **********
Dim id As Label = CType(dgi.FindControl("lblID"), Label)
'*********************************************************
Response.Redirect("dettInd.aspx?per=" & MeseScelto.SelectedItem.Value & "&tfs=" & id.Text)
End Sub
A final note... I don't understand why the value of the dropdownlist it's catched, but
all seem correct...the label is founded ... but the text of the label is always empty!!
Please, if anyone has any clue it would be really appreciated...thanks a lot!!!
Simone
PS = Sorry for bad quoting ^_^''
I've a problem... this is the situation:
In a Datagrid I have a column reporting an ID in a control Label
<asp:TemplateColumn Visible="False">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:Label id="lblID" runat="server" EnableViewState="True" Visible="False" >
<%# DataBinder.Eval(Container.DataItem, "ID") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
Then, in the last column of the datagrid, I've a dropdownlist, reporting interval values
as ListItem... let's say:
<asp:TemplateColumn HeaderText="Grafico">
<ItemTemplate>
<asp:DropDownList id="MonthDropDown" AutoPostBack="True" Runat="server" CssClass="combos" OnSelectedIndexChanged="ddlMese_SelectedIndexChanged">
<asp:ListItem Value="1">1 Mese</asp:ListItem>
<asp:ListItem Value="3">3 months</asp:ListItem>
<asp:ListItem Value="6">6 months</asp:ListItem>
<asp:ListItem Value="12">12 months</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
*****************************
The problem is, that I've to redirect the user to another page when he selects a value
in the dropdownlist, also bringin the ID of the first field.
In codebehind I use:
Protected Sub ddlMese_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim ddlMonth As DropDownList = CType(sender, DropDownList)
Dim dgi As DataGridItem = CType(ddlMonth.Parent.Parent, DataGridItem)
Dim ChoosenMonth As DropDownList = CType(dgi.FindControl("MonthDropDown"), DropDownList)
' this one should contain the value but it's always empty!!! **********
Dim id As Label = CType(dgi.FindControl("lblID"), Label)
'*********************************************************
Response.Redirect("dettInd.aspx?per=" & MeseScelto.SelectedItem.Value & "&tfs=" & id.Text)
End Sub
A final note... I don't understand why the value of the dropdownlist it's catched, but
all seem correct...the label is founded ... but the text of the label is always empty!!
Please, if anyone has any clue it would be really appreciated...thanks a lot!!!
Simone
PS = Sorry for bad quoting ^_^''