First, why do we need to know or care about some listview or grid view from a previous page? (answer: we don't need that information nor does it help).
(so your providing all kinds of information that does not matter - this might help explain your troubles here).
Your problem as stated is this:
I have a drop down list - I am having trouble assigning that drop down list a value.
One line of code!!!
Well, the first issue is a drop down list has TWO values. The display value, and the "behind" value. Thus it is VERY common to fill a combobox (dropdownlist) with two values.
You have:
DataTextField="vchDescripcionUnidad"
DataValueField="intIdUnidad"
So which kind of value are you attempting to assign here?
You can NOT directly assign the dropdown list a "text" value. You have to shove in the DataValue - not the text.
So, setting by "behind value" you can use this code:
DropDownList1.Text = 78
or
DropDownList1.SelectedValue = 78
But what if we only have the "text" value and not the number (DataValue).
(so just keep in mind that dropdown.Text = the data value behind - not the display text field).
To set by some text (display) value?
We have to find + search the list.
MS-Access and maybe VB6 allows assign of either way.
But, we can't do this:
DropDownList1.SelectedItem = "Athabasca Hotel"
So, we have to do this:
DropDownList1.SelectedValue = DropDownList1.Items.FindByText("Athabasca Hotel").Value
So the problem as stated here is one line of code.
So the problem as stated here is how to assign a dropdownlist a text value as opposed to the value behind.
All the other code, comments etc. is not really relevant to this problem.
But, if we want to assign the drop list by text display value? You have to translate that "text" supplied value to the number value used for that dropdown list.
So this:
Me.ddlDescripcion_Unidad.Text = dr("vchDescripcionUnidad")
becomes
Me.ddlDescripcion_Unidad.Text = ddlDescripcion_Unidad.Items.FindByText(dr("vchDescripcionUnidad")).Value
Edit:
Ok, while all of the above is much "fun and games"? The FIRST issue and ONLY issue we need to work on, think about, deal with, and resolve is to get/grab/pull the row we want to work on - that's quite much REALLY all we need to get working. All of that code, setting the combo box on the next page etc? That all comes AFTER we get the simple idea, the simple concept of selecting the ONE row value to pass to that other routine.
So, lets work on that:
we have this:
<asp:HyperLinkField Text="Modificar"
DataNavigateUrlFields="intIdGestiones"
DataNavigateUrlFormatString="Modificar_Gestiones-
SistemaRegistroGestiones.aspx?intIdGestiones={0}" />
We could change above to:
<asp:HyperLinkField Text="Modificar"
DataNavigateUrlFields="intIdGestiones"
DataNavigateUrlFormatString="Modificar_Gestiones-
SistemaRegistroGestiones.aspx?intIdGestiones='<%# Eval("intIdGestiones") %>' />
So now when you click on the link field, the value of intIdGestionses should be passed to your 2nd page.