Click here to Skip to main content
15,919,422 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: imp Pin
niki_nilu7-Nov-07 0:38
niki_nilu7-Nov-07 0:38 
AnswerRe: imp Pin
Guffa7-Nov-07 2:06
Guffa7-Nov-07 2:06 
QuestionGo to Top of the Page? Pin
Kasi Viswanathan6-Nov-07 23:43
Kasi Viswanathan6-Nov-07 23:43 
AnswerRe: Go to Top of the Page? Pin
N a v a n e e t h6-Nov-07 23:47
N a v a n e e t h6-Nov-07 23:47 
QuestionDropdown list selected index changed event problem Pin
Thanigaimani836-Nov-07 23:05
Thanigaimani836-Nov-07 23:05 
QuestionRe: Dropdown list selected index changed event problem Pin
Imran Khan Pathan7-Nov-07 0:34
Imran Khan Pathan7-Nov-07 0:34 
AnswerRe: Dropdown list selected index changed event problem Pin
Thanigaimani837-Nov-07 2:24
Thanigaimani837-Nov-07 2:24 
QuestionRe: Dropdown list selected index changed event problem [modified] Pin
Thanigaimani837-Nov-07 5:07
Thanigaimani837-Nov-07 5:07 
Hi
i checked checkbox values of dropdown list selected index changed event,values are coming from viewstate,so we want viewstate values add plus new checked checkbox values ,but if i click display button control that viewstate values are removing then new checked checkbox values are only diaplay .

see my code behind..

i can bold where i used viewstate and i can underlined the code of viewstate values are removing( i mean previous page checked checkbox values).




Protected Sub gridview1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gridview1.PageIndexChanging

gridview1.PageIndex = e.NewPageIndex

getselected()

databind1("First_name", "asc")

setSelected()


End Sub

------------------

Public Sub getselected()



Dim arrayListContactGroup As New ArrayList


If ViewState("ArrayList") IsNot Nothing Then

arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList)

ViewState.Remove("ArrayList")



End If

For Each row As GridViewRow In gridview1.Rows



Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label)



If chkselectcontacts.Checked Then



If Not arrayListContactGroup.Contains(arraylistlabel.Text) Then

arrayListContactGroup.Add(arraylistlabel.Text)



End If



Else



If arrayListContactGroup.Contains(arraylistlabel.Text) Then

arrayListContactGroup.Remove(arraylistlabel.Text)


End If



End If



Next

ViewState("ArrayList") = arrayListContactGroup

-------------------

Public Sub setSelected()



Dim arrayListContactGroup As New ArrayList



If ViewState("ArrayList") IsNot Nothing Then

arrayListContactGroup = CType(ViewState("ArrayList"), ArrayList)


End If

For Each row As GridViewRow In gridview1.Rows



Dim chkselectcontacts As CheckBox = CType(row.FindControl("chksel"), CheckBox)Dim arraylistlabel As Label = CType(row.FindControl("contid"), Label)



If arrayListContactGroup.Contains(arraylistlabel.Text) Then

chkselectcontacts.Checked = True



Else

chkselectcontacts.Checked = False



End If



Next



End Sub

--------------------------


Protected Sub Selcon_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Selcon.SelectedIndexChanged

getselected()

databind1(ViewState("sort"), ViewState("ascdesc"))

setSelected()



End Sub

My problem is,arraylist values(checkbox values) stored in viewstate,viewstate get the values no problem,but whenever i go to dropdown list select index change at that time we want add viewstate values and current checked checkbox values,but its doing opposite side operation i mean removing the view state value.see i can underlined that line.

Plz urgent hepl me




-- modified at 2:06 Thursday 8th November, 2007

Thanigaimani.thirumalai

QuestionVisual Studio .NET cannot open or create Pin
kuwl_mark6-Nov-07 23:02
kuwl_mark6-Nov-07 23:02 
AnswerRe: Visual Studio .NET cannot open or create Pin
Colin Angus Mackay6-Nov-07 23:17
Colin Angus Mackay6-Nov-07 23:17 
AnswerRe: Visual Studio .NET cannot open or create [modified] Pin
Sherin Iranimose6-Nov-07 23:18
Sherin Iranimose6-Nov-07 23:18 
QuestionPlease Help(Very Urgent) Pin
SreejithAchutan6-Nov-07 23:01
SreejithAchutan6-Nov-07 23:01 
AnswerRe: Please Help(Very Urgent) Pin
John-ph6-Nov-07 23:15
John-ph6-Nov-07 23:15 
AnswerRe: Please Help(Very Urgent) Pin
John-ph6-Nov-07 23:59
John-ph6-Nov-07 23:59 
QuestionHow to filter file's type in Openfile dialog? Pin
sakgumjorn6-Nov-07 23:01
sakgumjorn6-Nov-07 23:01 
AnswerRe: How to filter file's type in Openfile dialog? Pin
Michael Sync7-Nov-07 4:46
Michael Sync7-Nov-07 4:46 
GeneralRe: How to filter file's type in Openfile dialog? Pin
sakgumjorn7-Nov-07 14:44
sakgumjorn7-Nov-07 14:44 
Questionhyperlink control utility [modified] Pin
Sonia Gupta6-Nov-07 22:23
Sonia Gupta6-Nov-07 22:23 
AnswerRe: hyperlink control utility Pin
Christian Graus6-Nov-07 22:33
protectorChristian Graus6-Nov-07 22:33 
GeneralRe: hyperlink control utility Pin
Sonia Gupta6-Nov-07 22:52
Sonia Gupta6-Nov-07 22:52 
AnswerRe: hyperlink control utility [modified] Pin
Nitin19816-Nov-07 22:35
Nitin19816-Nov-07 22:35 
AnswerRe: hyperlink control utility Pin
Imran Khan Pathan6-Nov-07 22:37
Imran Khan Pathan6-Nov-07 22:37 
Questionrepeating template? Pin
dyonsos6-Nov-07 22:21
dyonsos6-Nov-07 22:21 
GeneralExpand and Collapse Detail Editing Pin
Brady Kelly6-Nov-07 22:14
Brady Kelly6-Nov-07 22:14 
GeneralRe: Expand and Collapse Detail Editing [modified] Pin
John-ph6-Nov-07 22:32
John-ph6-Nov-07 22:32 

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.