|
They need to be created before page load, and the exact same buttons need to be created on postback, in the same order, so that viewstate can be restored and the events can fire.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi guys.
i can explain for my doubt with example.see.my table have multiple type of employee details like as Mangemment,Programmer,Designers,Accountants,Contra ctEmployees.Each type of department having many employee details.Now my drop down list having types of department names like that above types of department names..if i select any one type of department data wil be display in gridview format .gridview data column as employee Name,Address,Phone_No,email_address and each every row with checkboxes.gridview showing data according to select the dept.No problem.
first I select Mangemment type of employee grid view showing that type of employee details ,here i checked first two employee details then checkbox values put in one viewstate,then i go to Programmer type of employee it showing that type employee details here i want to checked two employee details using checkbox but what happened first two checkboxes are already checked. so view state having proper checked check box values but problem is
whenever i go to select for another type of employee details checkboxes are checked based upon order of previous checked index.
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 put tears smile near code where i used viewstate and i can qustioned smile near 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.
Thanigaimani.thirumalai
|
|
|
|
|
How many times you posted this messages. If you are not able to do the suggestions provided, what is the use of reposting it. It's shame on you
1 - Your post here[^] (2 replies)
2 - Here[^]
I really don't know how people like you will survive in the programming field.
|
|
|
|
|
I want the code to display the roles that we selected from the location tag.i wrote clealrly that whn any 2 location tags are heer thn how we get the selected locations roles.........
|
|
|
|
|
SreejithAchutan wrote: I want the code to display the roles
You are in the wrong place. No one here will provide code for you. What happened when you tried jon's suggestion ?
|
|
|
|
|
I didnt get it.whn i tried i get the first location tags roles.also i tried to change the second location tags path by selecting the values .but in this case also it will be displayed in the first location tag.what is the reason i will attach the code with it.
string path = Server.MapPath("web.config");
string pageset = DropDownList2.SelectedItem.ToString();
XmlDocument xDoc = new XmlDocument();
xDoc.Load(path);
XmlNodeList nodeList = xDoc.GetElementsByTagName("location");
XmlNodeList nodeAppSettings = nodeList[0].ChildNodes;//Getting All The Location Tags
XmlNode nodeAuthorization = nodeAppSettings[0].ChildNodes[0];
XmlNode nodeAllow = nodeAuthorization.ChildNodes[0];
XmlAttribute XmlAttRoles = nodeAllow.Attributes[0];
XmlAttribute pageattr = nodeList[0].Attributes[0];
for (int i = 0; i < LocPath.Items.Count; i++)
{
if (LocPath.Items[i].Selected == true)
{
pageattr.InnerXml = pageset;
xDoc.Save(path); // saves the web.
}
}
Th LocPath is the dropdownlist that displays the page attribute .from there i select the 2 location tag path and select the changable value from the DropDownList2.whn i click the button event the path will be displayed in the first location tag.....why .plz help its urgent so i ask to u people.
|
|
|
|
|
SreejithAchutan wrote: I didnt get it
And there it is.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all
I want to put a auto complete action for my Textbox
The data shd come from database
I coded with javascript but the javascript not accepting the DB values
Thx In advance
Keerthi
|
|
|
|
|
If you are using VS2005, you have this control comes with AJAX toolkit.
|
|
|
|
|
Thx for reply
I am using 1.1 ver
Is there any idea in 1.1
Keerthi
|
|
|
|
|
kirthikirthi wrote: Is there any idea in 1.1
You need to write AJAX code and call it on keyup event for textbox. Create a div element on fly and show the results there. It will look like a autocomplete. If you are not at all familiar to write AJAX code check this[^] to get a starting,
|
|
|
|
|
Hi
can anybody tell how to develop Crystal reports using ilist
Regards
padma
|
|
|
|
|
dandamudi padma wrote: Crystal reports using ilist
What is this ? Do you mean binding data ?
|
|
|
|
|
|
Get all values from IList implemented class, and put it to a DataTable. Bind this DataTable to crystal reports
|
|
|
|
|
hi
i want to compare date using compare validator .and date format must be mm/dd/yyyy .how to set that??
Jintal Patel
|
|
|
|
|
Hi..
for your requirement ..
Regular Expression VAlidator is suitable...
Since u dont compare for a particular date... Compare Validator doesnt comes in to the picture...
use Regular Expression validator specifying the format for mm//dd/yyyy
Aswini
|
|
|
|
|
hi u can set the properties of the compare validator.
just go properties-type-date. By default the date is compared in mm/dd/yyyy format.
Happy programming...
any problem..just ask
--Krish
prfkrushna@gmail.com
|
|
|
|
|
Hi to all,
I have one query. Can anybody tell me what is N tier architecture.
I know little bit difference between single tier, two tier architecture
Can anybody tell me what is actual difference between single tier,two
tier and n tier architecture. If i am developing a site how can i know
its a single or multi tier architecture.
Thanks.
Rahul
People Laugh on me Because i am
Different but i Laugh on them
Because they all are same.
|
|
|
|
|
hi,
In a simple way, we can say like this...
Consider that your website is a database interactive application.so, you web site application will have code for displaying the data in the page and also for retriving the data from the databse. if you did the coding of retrival from DB and displaying it in UI in the code behind page, you are following single tier architecture. suppose if your DB retrival is a separate class or project consists of generic DB interaction class without depending on the Application context then it is two tier architecture. Means you DB layer is separate from UI layer, two components.
if you still separate the Business Layer then 3 tier architecture, that is the DB Layer as earlier and separting the UI as entity object being used in UI like for example Class Employee with business logic and Employee object is being used in UI layer(code behind file) then three tier architecture, having DB layer for DB interactions and Business Layer as Employee and third part is code behind file.
still we can proceed like this by using COM and web services. these are N tier architectures.
Cheers
asithangae
|
|
|
|
|
string path = Server.MapPath("web.config");
string newConnectionString = CheckBoxList1.SelectedItem.ToString();
string pageset = LocPath.SelectedItem.ToString();
XmlDocument xDoc = new XmlDocument();
xDoc.Load(path);
XmlNodeList nodeList = xDoc.GetElementsByTagName("location");
xDoc.Save(path);
XmlNodeList nodeAppSettings = nodeList[0].ChildNodes;//Getting All The Location Tags
XmlNode nodeAuthorization = nodeAppSettings[0].ChildNodes[0];
XmlNode nodeAllow = nodeAuthorization.ChildNodes[0];
XmlAttribute XmlAttRoles = nodeAllow.Attributes[0];
XmlAttribute pageattr = nodeList[0].Attributes[0];
XmlAttRoles.InnerXml = newConnectionString; // for value attribute
pageattr.InnerXml = pageset;
xDoc.Save(path); // saves the web.
If we have 2 location tag thn the location tags attribute path will be displayed in a dropdownlist.That code i know.But if i change the location path using the above code thn the changes will be occur in the first location tag only.How i change the location tag of second one using the above or any other code is avialable.Please help me .Its Urgent..Thanks
|
|
|
|
|
Hi All
I have a dropdownlist for country which is having countries, on the indexchange event of it i am filling states in another dropdownlist. state dropdownlist contains list of states for the country selected above. in the state list there is and item "other" if the user selects "other" the state dropdownlist disappears and a textbox appears. where then user can insert state name of his/her choice. My problem is after the state textbox has appeared if the user wants the list of states which wasin the dropdownlist he/she has to select some other country and then select the same country to get the state list filled in the dropdownlist.
In other words he has to change the index of the country to get the list back. i want what he should just click on the country name in the dropdownlist of country and the state dropdownlist should appear with the states.
can someone provide me the solution
Regards
|
|
|
|
|
Hi am binding the Data in the dropdownlist(cboYY).But after selecting the value am not getting the selected value always getting selectedIndex=-1 and the selected value is getting Null that code as follows
string a =Convert.ToString(cboYY.SelectedIndex);
string b = cboYY.SelectedValue;
Databinding code as follows
private void bindYear()
{
DataTable YearTable = new DataTable();
DataColumn YearColumn;
YearColumn = new DataColumn();
YearColumn.DataType = Type.GetType("System.String");
YearColumn.ColumnName = "dobYear";
YearTable.Columns.Add(YearColumn);
YearTable.Rows.Add("YYYY");
for (int i = 1940; i <= DateTime.Now.Year; i++)
{
YearTable.Rows.Add(i);
}
if (YearTable.Rows.Count > 0)
{
cboYY.DataSource = YearTable;
cboYY.DataBind();
}
YearTable.Dispose();
}
|
|
|
|
|
hi
if u use following code in page_load then all
code use within
if(!Page.IsPostback)
{
///statemane of ur programm here
}
no knowledge in .net
|
|
|
|
|
it is Listing all the values in the dropdownlist but when i select any value am not getting that value.getting selected value=null or selectedindex=-1
|
|
|
|