Link to home
Start Free TrialLog in
Avatar of Junior_Developer
Junior_Developer

asked on

Pass values in Hyperlink to other page

I have a hyperlink and need to pass 2 values from a page to be displayed on the different page (details.aspx page)

One value i want to send is selectedtext of dropdownlist and the other is in a textbox

<asp:hyperlink id="HyperLink1" runat="server" Width="120px" Target ="_blank" NavigateUrl="Details.aspx?">Add New Records

Avatar of Elvio Lujan
Elvio Lujan
Flag of Argentina image

in page_load:

HyperLink1.NavigateUrl = "Details.aspx?ddl="" + " & dropdownlist.clientid & ".value + ""&textbox="" + " & textbox.clientid & ".value"
in page_load:

HyperLink1.NavigateUrl = "Details.aspx?ddl=" &  dropdownlist.SelecyedItem.value & "&textbox="  &  textbox.text
Avatar of Junior_Developer
Junior_Developer

ASKER

this makes a little more sense let me try this
you can't use the pratima soluttion because you need to send the selected value in the moment when click the hyperlink... no in the page_load time
let me make it more clear what i want.
My dropdownlist has names of employees and i have to calling a stored procedure to get Ids of the selected employee.
i am calling a stored procedure to get ID's in dropdownlist _SelectedIndexChanged

Once this is done use can click on the Hyperlink and i want to pass the selected name in dropdown and the Id which i have as a string by calling the stored procedure.



did you try my solution posted?
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks a lot
this don't work for you...

try to select before the item in the dropdownlist and after write the textbox text...
and then press the hyperlink...
in the next page... you'll get an empty value for textbox text
instead of the textbox i have stored the id in a string and did exactly like pramita_mcs said
here is what worked for me.

HyperLink1.NavigateUrl = "Details.aspx?EmpName=" & ddlEmpNames.SelectedItem.Value & "&EmpID=" & strEmpID

Thanks for all your help