Click here to Skip to main content
15,897,891 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Different colors of text in textbox Pin
Dot-Net-Dev18-Dec-09 23:17
Dot-Net-Dev18-Dec-09 23:17 
GeneralRe: Different colors of text in textbox Pin
John Bracey19-Dec-09 2:41
John Bracey19-Dec-09 2:41 
QuestionDownload PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 19:53
Imran Khan Pathan18-Dec-09 19:53 
AnswerRe: Download PDF from MY SQL database in asp.net Pin
Sathesh Sakthivel18-Dec-09 19:56
Sathesh Sakthivel18-Dec-09 19:56 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 20:01
Imran Khan Pathan18-Dec-09 20:01 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Sathesh Sakthivel18-Dec-09 20:17
Sathesh Sakthivel18-Dec-09 20:17 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 20:36
Imran Khan Pathan18-Dec-09 20:36 
QuestionAdding items to dropdownlist from javascript, getting items from code behind... Pin
Jacob Dixon18-Dec-09 7:19
Jacob Dixon18-Dec-09 7:19 
I have a question.. I am trying to add items to a dropdownlist or select box and then when someone pushes the submit button (ASP.net button) it gets the list of items.

The problem is it doesn't work like that. It doesn't see any of the items. What I am doing is populating one dropdownlist with peoples names and email addresses from active directory (name == text, email == value). When you select the name and click add (HTML button) it adds the email to my other dropdownlist with javascript:

function btnAddEmail_onclick() {

    var cbCCEmails = document.getElementById("cbCCEmails");    
    var dropUserEmails = document.getElementById("<%= dropUserEmails.ClientID %>");
    
    var SelectedIndex = dropUserEmails.selectedIndex;
    var Email = dropUserEmails(SelectedIndex).value;
    var Name = dropUserEmails(SelectedIndex).text;
    
    if (SelectedIndex != -1)
    {
        cbCCEmails.options.add(new Option(Email, Name));
        dropUserEmails.remove(SelectedIndex);
    }
}


Now the code you see above takes the name from one box and adds the email to another one (cbCCEmails).

Now in the code behind im trying to loop through each ListItem. What I am tryign to do is CC all the emails in that listbox:

for (int i = 0; i < cbCCEmails.Items.Count; i++)
            {
                if (String.IsNullOrEmpty(CCEmails))
                    CCEmails = cbCCEmails.Items[i].Text;
                else
                    CCEmails += "," + cbCCEmails.Items[i].Text;

                mm.CC.Add(new MailAddress(cbCCEmails.Items[i].Text));
            }


Please ignore the CCEmails string.. that is used for inserting into a database.

I understand that i am losing the values on postback beacuse of the button, but how do I retain those values? ViewState is enabled but autopostback is not since im adding it with javascript. Teh reason I am using javascript on that side is because posting back takes to long and is slow
AnswerRe: Adding items to dropdownlist from javascript, getting items from code behind... Pin
Brij18-Dec-09 8:03
mentorBrij18-Dec-09 8:03 
GeneralRe: Adding items to dropdownlist from javascript, getting items from code behind... Pin
Jacob Dixon18-Dec-09 8:28
Jacob Dixon18-Dec-09 8:28 
Questionwizard Control! Pin
srikant.200918-Dec-09 4:35
srikant.200918-Dec-09 4:35 
AnswerRe: wizard Control! Pin
Brij18-Dec-09 5:58
mentorBrij18-Dec-09 5:58 
GeneralRe: wizard Control! Pin
sashidhar18-Dec-09 17:51
sashidhar18-Dec-09 17:51 
AnswerRe: wizard Control! Pin
sashidhar18-Dec-09 17:54
sashidhar18-Dec-09 17:54 
QuestionA question about web-design tools for ASP.NET Pin
James Shao18-Dec-09 2:52
James Shao18-Dec-09 2:52 
AnswerRe: A question about web-design tools for ASP.NET Pin
Ashfield18-Dec-09 9:03
Ashfield18-Dec-09 9:03 
Questionhow to access c# dll from javascript? Pin
iamdking18-Dec-09 2:49
iamdking18-Dec-09 2:49 
AnswerRe: how to access c# dll from javascript? Pin
Abhijit Jana18-Dec-09 3:35
professionalAbhijit Jana18-Dec-09 3:35 
AnswerRe: how to access c# dll from javascript? Pin
Ennis Ray Lynch, Jr.18-Dec-09 3:56
Ennis Ray Lynch, Jr.18-Dec-09 3:56 
AnswerRe: how to access c# dll from javascript? Pin
Abhishek Sur18-Dec-09 4:19
professionalAbhishek Sur18-Dec-09 4:19 
QuestionSystem.Web.UI.ScriptManager Pin
Subin Mavunkal18-Dec-09 2:11
Subin Mavunkal18-Dec-09 2:11 
AnswerRe: System.Web.UI.ScriptManager Pin
Abhishek Sur18-Dec-09 3:28
professionalAbhishek Sur18-Dec-09 3:28 
Questiondownload doc or open pdf file in brower Pin
Pankaj Saha18-Dec-09 1:54
Pankaj Saha18-Dec-09 1:54 
AnswerRe: download doc or open pdf file in brower Pin
Pankaj Saha21-Dec-09 18:41
Pankaj Saha21-Dec-09 18:41 
QuestionEvent is not firing in custon control. Pin
Imran Khan Pathan18-Dec-09 1:50
Imran Khan Pathan18-Dec-09 1:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.