fk_ID read value in server script
How can I get the value of the master ID in a Page Load server script of the detail table.
How can I get the value of the master ID in a Page Load server script of the detail table.
What do you want to do to get the Master table's key? If you work in Master/Detail relationship, you can get the primary key from the URL (except Add).
I want to set default values for the Add Page of the detail table by sql-reading the master-table. For that I need the key (master ID) in my script.
I know it is in the URL but I want it in the code and do not know how.
Thanks.
In Master/Detail Add or Add page, primary key is not available yet in Page_Load server event. Key will be available after you type (if it is not auto-number key).
Found a solution in ASP.NET C#.
Reading the URI works with : HttpContext.Current.Request.Url
To extract the master key in string-format (needed for my next SQL-string):
string strOrderID = (HttpContext.Current.Request.Url.Query.Split('='))[2];
Not so difficult, after all. ;-)
If the key is in the URL, you can simply use (C#) in Page_Load server event:
string key = ew_Get("key"); // Assume the url is : xxx?key=<keyvalue>
You can use the Build-In function (ew_Get()) in aspxfn*.cs.