anand Posted October 2, 2003 Posted October 2, 2003 Hi friends i have a small doubt..pls help me i have a function which returns applicationID..i want to pass that ApplicationID to all of my web pages.. my function ----------- <script language=vb runat="server"> public function getID() dim Idval Idval=Request.querystring("id") getId=Idval end function </script> in my webpage(applInformsec1.aspx) i am writing the code like this <tr align=center width="200"> <td><A href="appstatus1.aspx?ID=" &<%=GetId%> runat="server"><b >Applicantion Status of Appliant <%=getId%></B></A></TD></TR> <TR align=center width="200"> <td><A href="testHistory1.aspx?ID=" &<%=GetId%> runat="server"><b>Test History of Applicant <%=getId%></B></A></TD></TR> I am getting the error server tag not scripted well..pls give me a idea how can i pass values with hyperlink..and give me a idea abt Hidden variables also.. Thank you satya Quote Satya
customh2 Posted October 4, 2003 Posted October 4, 2003 Yo, you can try passing these params in the query string... <A HREF=MyApp.aspx?param1=value1¶m2=value2> Quote
MrNorth Posted October 6, 2003 Posted October 6, 2003 You do not have to bother with hidden variables in asp.net cause the framework handles this for you!! I recommend you read and fully understand the concept of viewstate and how postback works in asp.net! Short, I can say that all the values in your form page will automatically be saved in the viewstate upon postback (unless the control has enableviewstate = false) You can access values in the viewstate by using "viewstate" object... it is a whole new concept in asp.net... forget manual editing of hidden fields. About your querystring, is it possible to make <%=var%> in asp.net? I suggest you check <%# databinder.eval(somevalue) %> the <%# is a databinding expression and is used when you in the asp page want to bind a value to something... it might not work in this case since you ar enot really binding the value to a control, but do a search on the forums for querystrings in asp.net... kind regards Henrik Quote
customh2 Posted October 8, 2003 Posted October 8, 2003 Hey MrNorth, Thanx for the input, however, I do understand the passing of the viewstate (as long as the page is submitted by either Server.Transfer() or by the form action (post)). You can use the Cache.Insert and Cache.Get if your parameters can be set in the program in advance, however, consider the following scenario: You're building a table (kinda like a datagrid) that contains a row for each row in the database, andyou would like to include a button or hyperlink to edit or delete each row in the lefthand column. as you assemble each row of the table, you create a button like: <input type=button value="Edit" onClick="EditRecord(1001)"> or a hyperlink like ... <a href="#" onClick="EditRecord(1001)">Edit</a> You add a little javascript function: function EditRecord(recd_id) { window.open("MyPage.aspx?mode=edit&recd_id=" + recd_id); } The record ID (1001 in this case) is the unique key for the record to be edited, taken from the datatable while assembling the row. You will have no way of knowing in advance which button the user will want to click, so cacheing values won't help. By parsing the query string in MyPage.aspx, you can determine that the user wants to 'Edit' the record with recd_id "1001". Another note: you can append to the window.open URL: "&random=" + Math.Random() This adds a random number to the query string (you can ignore) which forces the client's browser to reload the page instead of retrieving it from cache.:D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.