Click here to Skip to main content
12,944,138 members (55,778 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 21:29pm
vinodkumarnie 31-Jan-13 3:37am
No way it is refreshing only in the background. Share your code..
gouravkaila 31-Jan-13 3:55am
<select id="DrpSearch" class="MedBodyTextBlack" style="width: 120" önchange="fCallJQuerySearch(this,'','FRMSEARCH');"
<option value="ALL" selected="selected">ALL</option>

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
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))
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
bAddForm = True
End If
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
'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
DrpSearch.SelectedIndex = 3
DrpFromList.SelectedIndex = Session("InboxFormIndex")
End If
Rate this: bad
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)
gouravkaila 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
Please Sign up or sign in to vote.

Solution 3

you can try location.reload() to refresh the page . take a look
gouravkaila 31-Jan-13 4:10am
I dont want the page flickering.. :(
Shubhashish_Mandal 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)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,653
CHill60 2,970
Maciej Los 2,388
Jochen Arndt 1,900
ppolymorphe 1,765

Advertise | Privacy | Mobile
Web01 | 2.8.170518.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2017
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