Thanks for the help, so I understand that it should be RegisterStartupScript(typeof(String), param2, param3) Or RegisterStartupScript(GetType("String"), param2, param3) instead of RegisterStartupScript(GetType(String), param2, param3) Appreciate the help Andy Carpe Diem
AndyCapp
Posts
-
ClientScript.RegisterStartupScript Problem -
ClientScript.RegisterStartupScript ProblemI have the following line of code string script = " document.location = '#cv'; "; Page.ClientScript.RegisterStartupScript(GetType(String), "goToError", script.ToString()); All it does is register a javascript routine for client side scripting. All the examples that I have looked at have exactly the same way of invoking the RegisterStartupScript method, however when I try and compile my code I receive a "'string' is a 'type' but is used like a 'variable'" Error message. I have tried string and String, however all sample that I have seen use the String, What am I doing wrong that I cannot get my code to compile. This is the only compilation error message that I receive. Thanks in advance Andy Carpe Diem -- modified at 4:25 Tuesday 11th April, 2006
-
Databinding to a Dropdownlist ProblemI have tried that and it is not the data source that is causing the problem as I have tried it with an item list, a collection base, a hashtable and and array, all with the same result. Carpe Diem
-
Databinding to a Dropdownlist ProblemI have a dropdown list control (lstState) that is contained within a user control (ucAddressInfo) which itself is contained on another user control (ucUserInfo) which finally is contained on an aspx page. So the heirachy is such Parent page is ASPX ------> User control ucUserInfo ------> contains ucAddressInfo --------> contains dropdownlist (lstState) as well as a datagrid (dglist) I then have the following code in the page_load event of the ucAddressInfo control (this is to create som test data. //Create a Datatable with some data DataTable oData = new DataTable(); oData.Columns.Add ("StateAbbrev", typeof(String)); oData.Columns.Add ("StateName", typeof(String)); DataRow oRow = oData.NewRow (); oRow["StateAbbrev"] = "AZ"; oRow["StateName"] = "Arizona"; oData.Rows.Add(oRow); lstState.DataValueField = "StateAbbrev"; lstState.DataTextField = "StateName"; //Set the DataSource of the DropDownList lstState.DataSource = oData; //Clear the datagrid control on the ucAddressInfo //User Control dgStates.Columns.Clear(); dgStates.AutoGenerateColumns = false; BoundColumn bCol = new BoundColumn(); bCol.HeaderText = "StateProvinceName"; bCol.DataField = "StateAbbrev"; dgStates.Columns.Add( bCol ); bCol = new BoundColumn(); bCol.HeaderText = "StateProvinceName"; bCol.DataField = "StateName"; dgStates.Columns.Add( bCol ); dgStates.DataSource= oData; // Do the databind of the Datagrid //This works fine dgStates.DataBind(); //Now do the databind of the DropDown list box lstState.DataBind(); //This fails with the following error "Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: value" Has Anyone else had this issue and how have you solved it. I have tried moving the lstState.Databind(); to the aspx page load, the ucAddressInfo OnInit event and numerous other places with no luck!!!! Thanks in Advance Carpe Diem