This explanation assumes knowledge of ASP.NET and provides a basic RedBack example. This examples uses a Stateless RBO to get details of Department codes and their descriptions from the RBO Server. These details are then stored within the page, so we only make a call to the RBO Server for these details when first entering the page. We create RedFields to store the codes and descriptions as these are used to parse the multi-values data // Create two RedField array-like objects to hold multivalue Dept codes and descriptions REDPAGESLib.RedField oCodes; REDPAGESLib.RedField oDescs; oCodes = new REDPAGESLib.RedField(); oDescs = new REDPAGESLib.RedField(); We then check to see if we already have the data within the page or whether we need to make a call to the RBO Server to get the required data. // do we need to get department details? if (Request.Form["Codes"] == null || Request.Form["Codes"] == "") { // use stateless RBO Utils to get department codes and text for dropdown obj = new REDPAGESLib.RedObject(); obj.Open2("rbexamples", "EXMOD:Utils","","",""); obj.CallMethod("GetDepts"); // now populate the redfields prop = (REDPAGESLib.RedProperty)obj.Property("DeptCodes"); oCodes.StringValue = prop.Value; prop = (REDPAGESLib.RedProperty)obj.Property("DeptDescs"); oDescs.StringValue = prop.Value; obj.Close(); } else { oCodes.StringValue = Request.Form["Codes"]; oDescs.StringValue = Request.Form["Descs"]; } We loop through the RedFields here, building a standard html dropdown with the correct item selected. <SELECT name="Dept"> <% // Set dept codes and descriptions string sel; for (int i = 1; i <= oCodes.Count; i++) { if (Dept == oCodes.get_Value(i).StringValue) { sel = "SELECTED "; } else { sel = "";} %> <OPTION <%= sel %> VALUE=<%= oCodes.get_Value(i).StringValue %> > <%= oDescs.get_Value(i).StringValue %> <% } %> </SELECT> See the rbexamplesnetcsharp directory to review the page's entire source code. |