Hi, this is a very good question. It works here because, we are adding a ListItem to the items collection of the dropdownlist. This is not going to affect the data in any way, that is associated with the dropdownlist thru the use of datasource property. Please let me know, if this clarifies your question. Good Luck.
@bebek89899 жыл бұрын
greatt. perfercto explanation. i follow the instruction n zero bug. thank you venkat
@crudhost8 жыл бұрын
Today, dataset is only to read/write very small subset of XML. LinQ to XML have no such restriction: var path = Server.MapPath("Countries.xml"); ListItem li = new ListItem("Select", "-1"); try { XElement data = XElement.Load(path); var countriesXML = from c in data.Elements("Country") select new ListItem { Value = c.Element("CountryID").Value, Text = c.Element("CountryName").Value }; foreach (var country in countriesXML) { this.CountryXMLDDL.Items.Add(country); } this.CountryXMLDDL.Items.Insert(0, li); } catch (Exception) { //You need to find the possible Exception throw; }
@875_rishabhprajapati72 жыл бұрын
Awesome video
@shiningyrlife9 жыл бұрын
You saved me!
@RoiTrigerman11 жыл бұрын
Hi and thank you for another great video. I have just one question: how come when you added the "Select" item to the list, after the DataBind, it still added the item to the list, whereas in a previous video you said that there is no way to change the DropdownList after the DataBind method was executed? thanks.
@amitsingh-hu9hz10 жыл бұрын
i have put a button under the list. Why isn't the 'select' item added to the list once more, each time i click the button like u show in tutorial 16. Although i haven't used (!IsPostBack).
@dgloria9 жыл бұрын
Excellent videos. Better to disable that select item ;)
@sapnarawal12266 жыл бұрын
Hello Sir, I have a question...Is all these videos in ASP.Net playlist are outdated or still i can follow them. As i can see you have uploaded it almost ^6 years back. Please reply. Regards , Sapna Rawal
@Csharp-video-tutorialsBlogspot6 жыл бұрын
Hello Sapna - Though ASP .NET is 6 years old technology, it still has it's use cases. Many organisations are still using ASP .NET web forms for their web application needs. If you know you will be working on applications built using web forms, I suggest learn ASP .NET and this playlist is still relevant for that. Hope this answers your question.
@sapnarawal12266 жыл бұрын
kudvenkat Thanks for ur reply Sir.🙏🏻
@Danial37254 жыл бұрын
Hello, thanks for this tutorial I am facing an issue displaying the dropdown list. I tried the code you provide but still can't display it I would appreciate it if you could help me Thank you
@shoaibmitha10 жыл бұрын
Hi, I typed the code exactly as you displayed it in the video, but I get the following errors: An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code Additional information: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'CountryName'. Could you help me with what I am doing wrong, Thanks.
@shoaibmitha10 жыл бұрын
Ok, never mind I figured out what I was doing wrong. It was the XML file: 101 India 102 USA 103 Australia 104 UK I had everything enclosed in the one tag... Thanks for the videos. There are a great help.
@MrHooglaz12 жыл бұрын
How, then, would I seet the clear button? Can't seem to find something that works. i want it to return to "select". thanks
@MrHooglaz12 жыл бұрын
nevermind. i went back to original ddl.SelectedIndex = -1; and all is well. Geez, i swear i tried that once and it didn't work. the joys of coding. thanks for another great vid.
@sebastube1234 жыл бұрын
What is the difference if I use Server.MathPath("..."); or if I just use the "~"?. As far I remeber "~" returns the relative path to the application.
@anuragmalik36369 жыл бұрын
awesome
@tbotee11 жыл бұрын
Roi Trigerman : You cannot change the source DataTextField and DataValueField after Binding, but you can add elements to the DropDownList