Click here to Skip to main content
15,886,137 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Sql updating using Visual studio 2005 and retrieving back the same Pin
mithoncs@8824-Apr-12 20:49
mithoncs@8824-Apr-12 20:49 
Questionnewbie help Pin
vila321023-Apr-12 20:44
vila321023-Apr-12 20:44 
AnswerRe: newbie help Pin
Bernhard Hiller23-Apr-12 23:24
Bernhard Hiller23-Apr-12 23:24 
Questionanyone can help me with my code? i got object must implement iconvertible error after i put file upload in my source code..please help me..im new in asp.net Pin
alip rosli23-Apr-12 10:51
alip rosli23-Apr-12 10:51 
AnswerRe: anyone can help me with my code? i got object must implement iconvertible error after i put file upload in my source code..please help me..im new in asp.net Pin
jkirkerx23-Apr-12 11:48
professionaljkirkerx23-Apr-12 11:48 
GeneralRe: anyone can help me with my code? i got object must implement iconvertible error after i put file upload in my source code..please help me..im new in asp.net Pin
vvashishta24-Apr-12 18:15
vvashishta24-Apr-12 18:15 
GeneralRe: anyone can help me with my code? i got object must implement iconvertible error after i put file upload in my source code..please help me..im new in asp.net Pin
jkirkerx24-Apr-12 19:29
professionaljkirkerx24-Apr-12 19:29 
QuestionUpdate Listbox values after AJAX call doesn't work Pin
papy-boom23-Apr-12 9:36
papy-boom23-Apr-12 9:36 
Hi,

I have listbox wich is dynamically updated with an AJAX call the declaration of the controls

C#
<asp:DropDownList ID="lb_Retour" name="drp_Retour" runat="server">
</asp:DropDownList> 
  
<asp:ListBox SelectionMode="Multiple" Height="160px" Width="300px" ID="lb_Info"
                                                    runat="server"></asp:ListBox>


In code behind i'm binding dropdownlist to datasource and adding OnChange Event to make an AJAX call with the function getvalues
C#
protected void Page_Load(object sender, EventArgs e)
{
        lb_Retour.DataSource = Ctx.Retours.OrderBy(n => n.Id).Select(n => n);
        lb_Retour.DataTextField = "Retour";
        lb_Retour.DataValueField = "Id";
        lb_Retour.DataBind();
        lb_Retour.Items.Insert(0, new ListItem("-Selectionner-", "0"));

        lb_Retour.Attributes["onchange"] = "getValues(this);";
                        
}

The javascript wich update the listbox values depending on dropdowlist selection

JavaScript
<script type="text/javascript">
        function getValues(Control) {
            var Code = Control.value;
            if (Control.value.trim() != "")
                $.ajax({
                    type: "POST",
                    url: "../Services/DomaineService.asmx/GetResponse",
                    data: "{ 'typeId': '" + Code + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: OnSuccess,
                    error: OnError

                });
        }
        function OnSuccess(data, status) {
            $('#ctl00_ContentPlaceHolder1_lb_Info').children().remove();
            $('#ctl00_ContentPlaceHolder1_lb_Info').append(data.d.ValueList);
         

        }
        function OnError(request, status, error) {
            alert(error.toString());
        }
 <script>

The data that returns the webservice is

HTML
<option value="1">toto</option><option value="2">titi</option><option value="3">tata</option>

below the Webservice Code

C#
[WebMethod]
        public ResponseInfo GetResponse(string typeId)
        {
            ResponseInfo xResponse = new ResponseInfo();
            xResponse.ValueList ="";
            PDataContext Ctx = new PDataContext();

            var query = (from objInfo in Ctx.Infos
                         where objInfo.Type == Convert.ToInt32(typeId)
                         select objInfo
                                     );
            foreach (InfoComplementaire item in query.ToList())
                    {
                             xResponse.ValueList +="<option value=\""+item.Id.ToString()+"\">"+item.InfoComplementaire1.ToString()+"</option>";
                    }
            
            return xResponse;
        }

Well everthing is ok the values are update depending on selected on the dropdownlist the probem is when i try to select item in the list box in code behind i get nothing at all item.Selected is always false when the option values comes from the AJAX call!!

Thank you for help
AnswerRe: Update Listbox values after AJAX call doesn't work Pin
jkirkerx23-Apr-12 12:02
professionaljkirkerx23-Apr-12 12:02 
AnswerRe: Update Listbox values after AJAX call doesn't work Pin
vvashishta23-Apr-12 18:31
vvashishta23-Apr-12 18:31 
GeneralRe: Update Listbox values after AJAX call doesn't work Pin
jkirkerx24-Apr-12 8:57
professionaljkirkerx24-Apr-12 8:57 
Questionimage in the body tag is not printing Pin
indian14323-Apr-12 7:14
indian14323-Apr-12 7:14 
AnswerRe: image in the body tag is not printing Pin
Not Active23-Apr-12 8:25
mentorNot Active23-Apr-12 8:25 
GeneralRe: image in the body tag is not printing Pin
indian14323-Apr-12 8:34
indian14323-Apr-12 8:34 
GeneralRe: image in the body tag is not printing Pin
Pete O'Hanlon23-Apr-12 9:12
mvePete O'Hanlon23-Apr-12 9:12 
GeneralRe: image in the body tag is not printing Pin
indian14323-Apr-12 10:24
indian14323-Apr-12 10:24 
GeneralRe: image in the body tag is not printing Pin
Pete O'Hanlon23-Apr-12 10:37
mvePete O'Hanlon23-Apr-12 10:37 
GeneralRe: image in the body tag is not printing Pin
indian14329-Apr-12 22:05
indian14329-Apr-12 22:05 
GeneralRe: image in the body tag is not printing Pin
Not Active23-Apr-12 12:21
mentorNot Active23-Apr-12 12:21 
QuestionCustomize HttpWebRequest in Compact Framework Pin
Tripathi Swati22-Apr-12 23:58
Tripathi Swati22-Apr-12 23:58 
AnswerRe: Customize HttpWebRequest in Compact Framework Pin
jkirkerx23-Apr-12 12:23
professionaljkirkerx23-Apr-12 12:23 
QuestionASP.Net Pin
fire_hawk22-Apr-12 21:15
fire_hawk22-Apr-12 21:15 
SuggestionRe: ASP.Net Pin
Richard MacCutchan22-Apr-12 21:28
mveRichard MacCutchan22-Apr-12 21:28 
AnswerRe: ASP.Net Pin
Chamila Nishantha22-Apr-12 22:16
Chamila Nishantha22-Apr-12 22:16 
AnswerRe: ASP.Net Pin
vvashishta24-Apr-12 18:27
vvashishta24-Apr-12 18:27 

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.