AnantLabs / rainbow

Automatically exported from code.google.com/p/rainbow
0 stars 0 forks source link

Problem in add new user into Manage Users module #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried to add new user into Manage Users module using the + icon button, 
and i'm getting an error "NullReferenceException was unhandled by user 
code:  Object reference not set to an instance of an object..."     and 
stop into RegisterFull.ascx.cs .. BindCountry() method, under line 
string CountriesFilter = portalSettings.CustomSettings
["SITESETTINGS_COUNTRY_FILTER"].ToString();

here is the code snippet:

private void BindCountry()

{

//Country filter limits contry list

string CountriesFilter = portalSettings.CustomSettings
["SITESETTINGS_COUNTRY_FILTER"].ToString();

CountryField.Items.Clear();

if (CountriesFilter.Length != 0)

{

CountryField.DataSource = CountryInfo.GetCountries(CountriesFilter);

}

else

{

CountryField.DataSource = CountryInfo.GetCountries
(CountryTypes.InhabitedCountries,CountryFields.DisplayName);

}

CountryField.DataBind();

}

Original issue reported on code.google.com by itsathe...@gmail.com on 20 Oct 2008 at 5:53

GoogleCodeExporter commented 9 years ago
same problem discussed already

go to portal management - go to properties of your portal
 go to user and security settings and set Allowed countries to world

Original comment by DVDobrov...@gmail.com on 20 Oct 2008 at 5:58

GoogleCodeExporter commented 9 years ago
thank u sir, But in 'user and security settings', i dont have Allowed country 
property. Im using rainbow version is 2.0.0.1881. Pls help me in this regards.

Original comment by itsathe...@gmail.com on 20 Oct 2008 at 7:05

GoogleCodeExporter commented 9 years ago
With this error, I correct it as follow:
(Actually I fixed code to fill data to and get data from combobox)

1. Comment the calling to BindCountry()  function 
from function private void Page_Load(object sender, EventArgs e)
of file DesktopModules \ Register \ RegisterFull.ascx.cs

2. Add the code below to function public int SaveUserData()
of file  DesktopModules \ Register \ RegisterFull.ascx.cs
if (CountryID.Equals(""))
                    CountryID = "IT";

Original comment by vuthiquy...@gmail.com on 24 Oct 2008 at 1:55

GoogleCodeExporter commented 9 years ago
guys with such a methods u can comment our have a project without researching 
the
roots of a problem 

Original comment by DVDobrov...@gmail.com on 24 Oct 2008 at 3:11

GoogleCodeExporter commented 9 years ago
Actually, this error has been corrected in  version Rainbow.1.1.rev.635, You 
can 
download that version and see.
All what I did is just copy code from version Rainbow.1.1.rev.635 to my Rainbow 
Project using version Rainbow2.0

I do as follow: (you can see the attached file for more detail)

1. Change code to fill data to combobox id="CountryField"  in RegisterFull.ascx 
as 
follow:

    <!--
    <asp:DropDownList id="CountryFieldXXX" runat="server" Width="350px" 
AutoPostBack="True" DataValueField="Name"
     DataTextField="DisplayName"></asp:DropDownList>
    -->
    <asp:DropDownList id="CountryField" runat="server" Width="350px" 
AutoPostBack="True" DataValueField="CountryID"
     DataTextField="Country"></asp:DropDownList>

2. Update Function BindCountry() in file DesktopModules \ Register \ 
RegisterFull.ascx.cs

  private void BindCountry()
  {
            DataTable dtCountries = new DataTable("Countries");
            string sql = "Select CountryID, Country From rb_Countries Order By 
Country";
            dtCountries = DBHelper.GetDataSet(sql).Tables[0];

            if (dtCountries == null || dtCountries.Rows.Count == 0)
                ErrorHandler.Publish(LogLevel.Warn, "No Countries Returned in bind 
conutry");

            //  TODO : Fix this
            //dtCountries.ReadXml
(Rainbow.Framework.Settings.Path.ApplicationPhysicalPath 
+ "\\App_GlobalResources\\Countries.xml");
            //if (CountriesFilter.Length != 0)
            //{
            // CountryField.DataSource = CountryInfo.GetCountries(CountriesFilter);
            //}
            //else
            //{
            // CountryField.DataSource = CountryInfo.GetCountries
(CountryTypes.InhabitedCountries,CountryFields.DisplayName);
            //}

            CountryField.DataSource = dtCountries;
            CountryField.DataBind();
  }

3. Add data for Country Field in rb_Countries Table

Hope that it will be usefull for you.

Original comment by vuthiquy...@gmail.com on 8 Nov 2008 at 5:40

Attachments:

GoogleCodeExporter commented 9 years ago
I have the same problem. The strange is that when I've edited the code as you 
suggested and Shift F5 to compile it again it doesnt help. It complains at 
exactly 
the same codeline which is now wrong as the lines have been shifted. Somehow 
the 
chwanges just dont bite. Cacheproblem?

Original comment by froad...@gmail.com on 18 Nov 2008 at 9:07

GoogleCodeExporter commented 9 years ago
Hi froadrik,

<Hi! Im having the same problem as above. I downloaded the production/stable 
version 
and tried to use the correction as you suggested, but when i try to compile the 
same 
error appears. Is it wrong of me to use the public release-version when I want 
to 
change the code and in case i need the source code, where do I get the latest 
version?>

All you need is go to the site to download the latest version of Rainbow2.0.rar,
and version with corrected BindCountry() function in RainbowPortal2.0.Beta1.7z 
version: 
http://code.google.com/p/rainbow/downloads/list

Original comment by vuthiquy...@gmail.com on 26 Nov 2008 at 9:02

GoogleCodeExporter commented 9 years ago
That is what I did last time but i still have the problem of not being able to 
compile as i mentioned in comment 6.

Original comment by froad...@gmail.com on 26 Nov 2008 at 9:24

GoogleCodeExporter commented 9 years ago
I think you should attach the taken screen pictures at run time before and at 
the
time you see the problems. So, maybe someone can help.

Original comment by vuthiquy...@gmail.com on 27 Nov 2008 at 2:04

GoogleCodeExporter commented 9 years ago
I looked at the RainbowPortal2.0.Beta1.7z version but when I compile i dont get 
the 
samt types of DLL as inte the 2.0 production version. I suppose I need a new 
Rainbow.Modules.Register.dll to make it work? In that case, can someone email 
me the 
necessary files to maake it work? froadrik@gmail.com

Original comment by froad...@gmail.com on 30 Nov 2008 at 3:25

GoogleCodeExporter commented 9 years ago
Dear  vuthiquynhngoc,
I used ur solution and modified the code as you suggested, but the problem still
appear the same as before...Any one can help us to solve this problem?
We need to edit,add, delete users...this is very important in our 
Rainbows...please
solve this problem

Original comment by obarah...@hotmail.com on 29 Dec 2008 at 12:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
private void BindCountry()
        {
            //Country filter limits contry list
            string CountriesFilter=string.Empty;

            if (portalSettings.CustomSettings["SITESETTINGS_COUNTRY_FILTER"]!=null)
                CountriesFilter =
portalSettings.CustomSettings["SITESETTINGS_COUNTRY_FILTER"].ToString();

            CountryField.Items.Clear();
            CountryInfo[] countries=null;
            if (CountriesFilter.Length != 0)
            {
                countries = CountryInfo.GetCountries(CountriesFilter);
            }
            else
            {
                countries =
CountryInfo.GetCountries(CountryTypes.InhabitedCountries,CountryFields.DisplayNa
me);
            }

            if (countries!=null)
            {
                CountryField.DataSource=countries;
                CountryField.DataBind();
            }
        }

Original comment by duongdra...@gmail.com on 29 Dec 2008 at 2:23

GoogleCodeExporter commented 9 years ago
Code was added to the main trunk for this fix.

Original comment by rams...@gmail.com on 16 May 2010 at 5:18