Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML Ajax DOM
Dear All,
 
I need urgent help as i am unable to refresh the HTML of my .aspx page after a code behind call(using Ajax)to the same page.
 
I am calling the code behind via ajax on the selectedindexchange of a dropdown.
In that code behind,I am loading and setting some properties of another dropdown list.
 
This is running fine in code behind but not reflecting on the HTML of the page.
 

Is there any way to do that?
 
Any help,suggestion and link if you could provide.
Posted 30-Jan-13 22:29pm
Comments
vinodkumarnie at 31-Jan-13 3:37am
   
No way it is refreshing only in the background. Share your code..
gouravkaila at 31-Jan-13 3:55am
   
<select id="DrpSearch" class="MedBodyTextBlack" style="width: 120" önchange="fCallJQuerySearch(this,'','FRMSEARCH');"
runat="server">
<option value="ALL" selected="selected">ALL</option>
</select>
 
here fCallJQuerySearch is my JS to call the code behind which performs following action
 

Public Function fPopulateSearch(ByRef strRet As String) As Boolean
Dim dtInboxData As New DataTable
Dim sFormLstval As String = ""
Dim ngtpInbox As New NGTP.TPFlow.ClientDLL.clsInbox
Dim strErrMsg As String
Try
If UCase(Session("sInboxType")) = "INBOX" Then
If DrpFromList.Items.Count <= 1 Then
If DrpSearch.SelectedIndex = 3 Then
txtSearchInput.Visible = False
DrpFromList.Visible = True
If Not ngtpInbox.fbInitObject(Session("AppName").ToString, Session("SQLConStr").ToString, Session("DBType").ToString, Session("UserName").ToString) Then
strErrMsg = ngtpInbox.pErrDesc
ngtpInbox = Nothing
End If
If Not ngtpInbox.fbGetAllDataInbox(Session("UserName"), dtInboxData) Then
strErrMsg = ngtpInbox.pErrDesc
ngtpInbox = Nothing
End If
' If Trim(Session("InboxFormList_New")) = "" Then
 
Dim sInboxFormLst As String = ""
Dim sformCapChk() As String
Dim bAddForm As Boolean = False
If Not IsNothing(dtInboxData) Then
For iCounter As Integer = 0 To dtInboxData.Rows.Count - 1
If iCounter = 0 Then
ReDim sformCapChk(iCounter)
sformCapChk(iCounter) = Convert.ToString(dtInboxData.Rows(iCounter)(9))
sFormLstval = sFormLstval & "," & Convert.ToString(dtInboxData.Rows(iCounter)(9))
Else
For iTemp As Integer = 0 To UBound(sformCapChk)
If sformCapChk(iTemp).IndexOf(Trim(Convert.ToString(dtInboxData.Rows(iCounter)(9)))) >= 0 Then
bAddForm = False
Exit For
Else
bAddForm = True
End If
Next
If bAddForm = True Then
Dim iTemp As Integer
iTemp = UBound(sformCapChk) + 1
ReDim Preserve sformCapChk(iTemp)
sformCapChk(iTemp) = Convert.ToString(dtInboxData.Rows(iCounter)(9))
sFormLstval = sFormLstval & "," & Convert.ToString(dtInboxData.Rows(iCounter)(9))
End If
End If
Next
'Session("InboxFormList_New") = sFormLstval
End If
'End If
'End Anurag
If Not fbFormList(sFormLstval) Then
End If
If Not IsPostBack And Session("InboxBtnClick") Then
'Anurag 2 Jan 2009
If Session("STRFILTER") = "CONTROLCAPTION" Then
DrpSearch.SelectedIndex = 3
DrpFromList.SelectedIndex = Session("InboxFormIndex")
End If
En
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In that case no need to refresh the page. Because of if you refresh the page then the purpose of using ajax is meaningless.Instead create the list in javacsript.
 
There are two way to create element.
 
1. creating the element object see this
 
2. Creating the innerhtml for select see this (last one)
  Permalink  
Comments
gouravkaila at 31-Jan-13 3:59am
   
I know this solution sir,I just wanted to confirm whether there is some way or not.
Anywaz thanks alot.. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

you can try location.reload() to refresh the page . take a look
  Permalink  
Comments
gouravkaila at 31-Jan-13 4:10am
   
I dont want the page flickering.. :(
Shubhashish_Mandal at 31-Jan-13 4:48am
   
then go with solution 1.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150305.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100