c# - ASP.net web page update issue ( Postback?) -
greeting of day everyone.
hoping well. need solve simple issue ( new c# + asp.net).
i have created asp.net portal. when user open portal (web page). webpage give him list of groups member of , list of group can add himself..
it contain 2 drop downs. 1 contains list of groups, use can add themselves. second 1 contains list of groups , user member of, , can remove groups.
adding , removing code working fine. have refresh page manually show updated information. after clicking add or remove button page not refreshing updated information.
i tried use redirected main page using response.redirect("success.aspx")
but nothing working,
protected void page_load(object sender, eventargs e) { string un = "domain\\michael.jackson"; //systemresources sr = new systemresources(); //activeuser usr = sr.getuserdetails(un).firstordefault(); labelusername.text = "michael.jackson"; // getting list of groups using of praticular ou classorgunitgroup string sdomain = classgroupportalsettings.getdomainname(); string sinterstou = "ou=testing,dc=analysys,dc=com"; classorgunitgroup = new classorgunitgroup(); list<string> allgroups = a.getgroupfromou(sdomain, sinterstou); string grouplist = "<ul>"; foreach (string group in allgroups) { grouplist = grouplist + "<li><a href='showgroupmembers.aspx?group=" + group + "'>" + group + "</a></li>"; } grouplist = grouplist + "</ul>"; lblopengroups.text = grouplist; //// 4. finding users group membership. string sdomain = classgroupportalsettings.getdomainname(); classusergroupmembership mymembership = new classusergroupmembership(); list<string> mygroupsmem = mymembership.getmygroupmembership(sdomain, "domain\\michael.jackson"); string gllist = "<ul>"; string openllist = "<ul>"; string othergroup = "<ul>"; foreach (string grp in mygroupsmem) { //bulletedlistmygroups.items.add(grp); gllist = gllist + "<li>" + grp + "</li>"; if (allgroups.contains(grp)) { dropdownlistmygroups.items.add(grp); openllist = openllist + "<li>" + grp + "</li>"; } else { othergroup = othergroup + "<li>" + grp + "</li>"; } } gllist = gllist + "</ul>"; openllist = openllist + "</ul>"; othergroup = othergroup + "</ul>"; labelothergrp.text = othergroup; labelopengrp.text = openllist; // labelmygroup.text = gllist; foreach (string emailgroup in allgroups) { if (!mygroupsmem.contains(emailgroup)) { dropdownlistopengroups.items.add(emailgroup); } } }
this code run when page reload.
the issue : when click on remove button or add button, run code add or remove user selected group. when page reload after clicking on button. group membership labels. , dropdown box not updating code :(
i'm assuming scenario this, you're having 2 drop down. 1 full of records , items can select. once items selected, user submit button records save database/xml. later you're retrieving items db/xml , showing in second drop down.
now you're issue records not showing in second drop down after clicking submit button,
if so, have 2 options.
1) can pull records insert things made db. 2) can pull records in page load mentioned below,
if(postback) // or if(postback == true) { // pull records , display in drop down. }
Comments
Post a Comment