Asp.Net and Jquery AJAX to Bind DropDownList dynamically from Sql server database

  Рет қаралды 62,916

Vetrivel D

Vetrivel D

Күн бұрын

Пікірлер: 26
@sriramr1981
@sriramr1981 4 жыл бұрын
Semma ji... Very useful. Thanks a lot
@tjkingchan8564
@tjkingchan8564 9 жыл бұрын
Thank you very much. This is my best Solution for me. after I find out all the world.
@VetrivelD
@VetrivelD 9 жыл бұрын
+ทนงศักดิ์ จันทะสิงห์ Thank You.. Please Post your Question?
@howard123666
@howard123666 9 жыл бұрын
Thank you for your Video! It's very useful to me!
@graysonelliott5649
@graysonelliott5649 3 жыл бұрын
i know I'm kinda randomly asking but do anyone know a good website to stream new tv shows online?
@DavidG-qm5vf
@DavidG-qm5vf 9 жыл бұрын
Nice video! Thanks for your video!
@VetrivelD
@VetrivelD 9 жыл бұрын
+Jose David Thank You.. Please Post your Question?
@VetrivelD
@VetrivelD 9 жыл бұрын
Step: 1 Step: 2 Populate DropDownList using jQuery AJAX Select Student: Step: 3 using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Web.Services; Step: 4 public class Student { public string StuId { get; set; } public string StuName { get; set; } } [WebMethod] public static List PopulateDropDownList() { DataTable dt = new DataTable(); List objDept = new List(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("SELECT ID,Stu_Name FROM Student", con)) { con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { objDept.Add(new Student { StuId = dt.Rows[i]["ID"].ToString(), StuName = dt.Rows[i]["Stu_Name"].ToString() }); } } return objDept; } } } Step: 5 $(document).ready(function () { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", //url is the path of our web method (Page name/function name) url: "JQueryBindDropDown.aspx/PopulateDropDownList", data: "{}", dataType: "json", //called on jquery ajax call success success: function (result) { $('#ddlStudent').empty(); $('#ddlStudent').append("--Select--"); $.each(result.d, function (key, value) { $("#ddlStudent").append($("").val(value.StuId).html(value.StuName)); }); }, //called on jquery ajax call failure error: function ajaxError(result) { alert(result.status + ' : ' + result.statusText); } }); });
@savithirir7282
@savithirir7282 5 жыл бұрын
What result
@RaulJordan23
@RaulJordan23 7 жыл бұрын
Thank you very much!. it was very usefull!!!!
@VetrivelD
@VetrivelD 7 жыл бұрын
Thanks for your valuable feedback. Refer our channel in your friend circle.
@SaiRam1990_
@SaiRam1990_ 11 ай бұрын
Hi i saw your video. Very helpful. But i need the same for gridview . Pls help me
@alexanderrodrigues9003
@alexanderrodrigues9003 5 жыл бұрын
Thank you!!!
@priyankatripathi562
@priyankatripathi562 9 жыл бұрын
Can you please provide the script of the code because I am unable to get the code and I have having two column in a table States and country so is it necessary to have ID column also.I want to populate the States only and on the basis of selection of State in Dropdownlist I need to pupulate the Cities name in the checkboxlist and that checkboxlist should be bind from database.Can you please help me on this.Thanks
@priyankatripathi562
@priyankatripathi562 9 жыл бұрын
Hi Sir,Can you help on the same on the problem I have mentioned.
@ikramlim
@ikramlim 8 жыл бұрын
Thank you very much. but I have a question if I want to bind the data from service how I can change it?? Example public void GetAgencyNames() { var listOfAgencyNames = UserProfileService.GetAgencyNames(agencyNAMEVO); DropDownAgencyName.DataSource = listOfAgencyNames; DropDownAgencyName.DataValueField = "AgencyName"; DropDownAgencyName.DataTextField = "AgencyName"; DropDownAgencyName.DataBind(); DropDownAgencyName.Items.Insert(0, new ListItem("Please select a value", "")); } Please help.. Thanks
@jasminem8457
@jasminem8457 4 жыл бұрын
I tried this one before watching this,the same way I bind ddl with Ajax...and work out for me, but after that in save button I have to save the ddl value to the db table, but I get the selected value as empty...I stuck with this today...🤔
@pshah2952
@pshah2952 9 жыл бұрын
Good clear steps but very slow video
@kibelo2267
@kibelo2267 5 жыл бұрын
Nice!!!
@duttpankaj5477
@duttpankaj5477 7 жыл бұрын
hi sir can u provide code like if i am select picture of state there city picture is open.if i select city picture there area picture will display.the query is like state?cityid=1.please sir provide this code.
@humbertoporras4488
@humbertoporras4488 6 жыл бұрын
Thanks
@kishanwebsolution8690
@kishanwebsolution8690 7 жыл бұрын
plz sir solve my problem product searching use autocomplete
@shwetabhat6815
@shwetabhat6815 3 жыл бұрын
Can I get code please
@diegodiaz6815
@diegodiaz6815 7 жыл бұрын
step 1 step2 step 3 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Web.Services; public partial class AjaxDataBlindDropDown : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public class cierre { public string idCierreInd { get; set; } public string Cierre { get; set; } } [WebMethod] public static List ddl() { DataTable dt = new DataTable(); String CS = ConfigurationManager.ConnectionStrings["t3Procesos"].ConnectionString; List objDept = new List(); using (SqlConnection con = new SqlConnection(CS)) { using (SqlCommand cmd = new SqlCommand("SELECT TOP 100 idCierreInd,Cierre from [t3Procesos].dbo.m_cierreIndividual", con)) { con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { objDept.Add(new lcierre { idCierreInd = dt.Rows[i]["idCierreInd"].ToString(), Cierre = dt.Rows[i]["Cierre"].ToString() }); } } return objDept; } } } } step 4 $(document).ready(function(){ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "AjaxDataBlindDropDown.aspx/ddl", data: "{}", dataType: "json", success: function (result) { $('#DropDownList1').empty(); $('#DropDownList1').append("--Select--"); $.each(result.d, function (key,value) { $('#DropDownList1').append($("").val(value.idCierreInd).html(value.Cierre)); }); }, failure: function ajaxError(result) { alert(result.status +':'+ result.statusText); } }); });
Calling asp net web services using jquery ajax
15:44
kudvenkat
Рет қаралды 97 М.
Cascading dropdownlist using jquery and asp net
29:12
kudvenkat
Рет қаралды 63 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Cascading Dropdownlist In Asp.Net MVC | Using Jquery Ajax
15:56
abctutorial
Рет қаралды 113 М.
jQuery datatables get data from database table
21:04
kudvenkat
Рет қаралды 283 М.
Calling aspx page method using jquery
11:12
kudvenkat
Рет қаралды 83 М.
ASP.Net MVC jquery Ajax Tutorials Part 1
10:01
Rock Nation
Рет қаралды 22 М.
Full CRUD operation using datatables in ASP.NET MVC
1:07:51
sourav mondal
Рет қаралды 562 М.
Upload and display excel file content in gridview using asp.net
13:07
Asp Net Pass Value to One Page to Another Page Step By Steps
22:32
jQuery Ajax CRUD in ASP.NET Core MVC using Popup Dialog
59:47
CodAffection
Рет қаралды 180 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН