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

Junior_DeveloperAsked:
Who is Participating?
 
Pratima PharandeConnect With a Mentor Commented:
use
HyperLink1.NavigateUrl = "Details.aspx?ddl=" &  dropdownlist.SelecyedItem.value & "&textbox="  &  textbox.text

at the end og  dropdownlist _SelectedIndexChanged
0
 
Elvio Lujan.Net Senior DeveloperCommented:
in page_load:

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

HyperLink1.NavigateUrl = "Details.aspx?ddl=" &  dropdownlist.SelecyedItem.value & "&textbox="  &  textbox.text
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Junior_DeveloperAuthor Commented:
this makes a little more sense let me try this
0
 
Elvio Lujan.Net Senior DeveloperCommented:
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
0
 
Junior_DeveloperAuthor Commented:
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.



0
 
Elvio Lujan.Net Senior DeveloperCommented:
did you try my solution posted?
0
 
Junior_DeveloperAuthor Commented:
thanks a lot
0
 
Elvio Lujan.Net Senior DeveloperCommented:
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
0
 
Junior_DeveloperAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.