title: any way to get sharepoint groups with a given site url
body: <p>I'm getting a stuck. Suppose that I create 5 sites. For each one, I create a few sharepoint groups. So, I create a dropdownlist control to bind 5 sites and when I click on any site there, I will get sharepoint groups created on it. But I always see the dropdownlist used to bind these groups still never change. I mean it only binds a few default groups in sahrepoint everytime. The new created groups is not. </p>
  
  <p>And I have confusion like this</p>
  
  <p>web.AssociatedGroups
  web.Groups
  web.SiteGroups</p>
  
  <p>which one we will use this case ? Please guide me</p>
  
  <p>Here my snippet code</p>
  
  <p>private void BindSPGroupsToDropDownList(DropDownList ddl, string siteUrl)
          {</p>
  
  <pre><code>        ddl.Items.Clear();
          try
          {
              SPSecurity.RunWithElevatedPrivileges(delegate()
             {
                 using (SPSite site = new SPSite(siteUrl))
                 {
                     using (SPWeb web = site.OpenWeb())
                     {
                         //web.SiteGroups
                         foreach (SPGroup spGroup in web.Groups)
                         {
  
  
                             ddl.Items.Add(new ListItem(spGroup.Name.Trim(), spGroup.ID.ToString()));
  
  
  
                         }
  
                     }
                 }
             });
          }
  </code></pre>
  
  <p>}</p>
  
  <p>thanks in advance</p>