Bind data source as per control selection in ASP.Net

Abstract:
Every  originization always hunting quality resources for project development.so every interview round there is   always  technical round. To check the technical knowledge .some times logical question are asked .one of my firend asked one question.so I m thinking write article  and share with all of you.
Problem statement:
Without   writing one line of code do the following  task
bind  student_ id  to dropdownlist .display details of student in gridview  as per   student _id of  dropdownlist  in  ASP.Net?
Note:  Problem statement was very complicated,but I write is easy way.
Solution:
 So many times programmer are confused how it is possible to without write one line of code.some  are says   it is impossible to do without write one line of code.some are know only  bind data to control using data souce.but  don’t know how we check  as per condition?.
It is possible in ASP.Net .
Lets learn step by step .
Step 1:
 Open Visual studio .Click on  File->New ->Website.
Step 2:
Select language as Visual c#  and template as  ASP.NET  web Forms site.give appopriate name and location and click on ok.


Step 3:
Drag and drop Dropdownlist on page . check the “Enable Autopostback”. for binding data source  select choose data souce.  


Step  4:
Select  ” New DataSource”  form first dropdownlist
Step 5:
Choose data souce which you want to bind. I choose SQL data souce.click on OK.


Step  6:
If you have already bind datasouce then choose in the dropdownlist otherwise Click on New Connection.I choose New Connection.
Step 7:
Enter server name and choose authentication .if server Authentication then enter UserName and Password  .also select database .and for conformation of Test connection  click on Test Connection. If connectin is  successed it display message click on OK.again click on OK to close the windows.
Step 8:
Now display connection string .click on Next.
Step 9:
Check  the connection string save in configuration file .and click on Next .
Step 10:
Here  dropdownlist we are only bind to  Student_id  so check student_id .and click on Next.
Step 11:
Click on Test Query to display avaliable  student _id in database.click on finish.
Step 12:
Finally it display all the detail which you bind to dropdownllist click on ok.
Now all the student_id are bind to the dropdownlist.
Next we need to display record as per dropdownlist value to gridview.
Step 13:
drag and drop one gridview  .select “New data Souce”


Step 14:
Select SQL  Datsource Type  and click on OK
Step 15
Now directly choose the connection string click on Next


Step 16:
click on Next
Step 17:
Check   *  to display all record now we need to display record as per condition .click on where


Step 18 :
Select coloum  is  student_id ,operator  is =,and now here is Main thing here we can bind the source.you can bind source on that various ways.here we are going to bind the control.choose control ID as dropdownlist .click on Add and then OK button,
Step 19:
Now click on Test Query .aske to enter Parameter.eg I enter Student id as a parameter  1 and click ok


Step 20 :
Now he display record as per parameter which passed.Now click on Finish.
Step 21:
Now Run the webpage and check.it display details of student as per student id of dropdownlist.


Hope you like my article  .
if you have any such tkind  of problem statement frankly drop mail to me  dotnetbyabhipatil@gmail.com  .i am happy to help you and give better soluton.
For more  article visit my blog.  http://dotnetbyabhipatil.blogspot.in


your feedback and suggestion is always welcome for me.
Previous
Next Post »

38 comments

Click here for comments
5 January 2015 at 06:15 ×

Thanx a lot sir,its really helpful..

Reply
avatar
Unknown
admin
4 April 2015 at 01:01 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
4 April 2015 at 02:00 ×

No more live link in this comments field

Reply
avatar
glennparyy
admin
8 April 2015 at 00:39 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
8 April 2015 at 00:54 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
8 April 2015 at 00:56 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
10 April 2015 at 04:05 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
10 April 2015 at 04:08 ×

No more live link in this comments field

Reply
avatar
IICT
admin
16 June 2015 at 04:19 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
23 July 2015 at 02:31 ×

Thanks for the useful information sir...

Reply
avatar
Anonymous
admin
12 February 2016 at 05:56 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
15 February 2016 at 06:16 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
15 February 2016 at 06:22 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
16 February 2016 at 21:17 ×

No more live link in this comments field

Reply
avatar
geethu mmd
admin
17 February 2016 at 03:24 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
1 March 2016 at 22:51 ×

No more live link in this comments field

Reply
avatar
Geethapriya
admin
3 March 2016 at 22:12 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
3 March 2016 at 22:27 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
4 March 2016 at 23:11 ×

No more live link in this comments field

Reply
avatar
Unknown
admin
23 March 2016 at 07:59 ×

No more live link in this comments field

Reply
avatar
Aashi siva
admin
6 July 2016 at 02:17 ×

No more live link in this comments field

Reply
avatar
25 July 2016 at 02:46 ×

No more live link in this comments field

Reply
avatar
raphael
admin
10 August 2016 at 06:28 ×

No more live link in this comments field

Reply
avatar
deeksha
admin
23 August 2016 at 02:53 ×

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

Reply
avatar
Unknown
admin
24 August 2016 at 03:19 ×

No more live link in this comments field

Reply
avatar
Anonymous
admin
23 October 2016 at 02:54 ×

No more live link in this comments field

Reply
avatar
service care
admin
9 March 2019 at 02:42 ×

No more live link in this comments field

Reply
avatar
saranya
admin
10 August 2019 at 04:48 ×

No more live link in this comments field

Reply
avatar
24 October 2019 at 01:48 ×

No more live link in this comments field

Reply
avatar
rocky
admin
15 July 2020 at 07:40 ×

No more live link in this comments field

Reply
avatar
Jayalakshmi
admin
7 August 2020 at 10:28 ×

No more live link in this comments field

Reply
avatar
Devi
admin
11 August 2020 at 02:49 ×

No more live link in this comments field

Reply
avatar
shiny
admin
17 August 2020 at 04:39 ×

No more live link in this comments field

Reply
avatar
14 October 2020 at 02:50 ×

Good Post! it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article, I want to say that also a well-written article with some very good information which is very useful for the AWS Online Training

Reply
avatar
Prwatech
admin
13 January 2021 at 09:37 ×

No more live link in this comments field

Reply
avatar
8 May 2021 at 21:13 ×

asp.net mvc interview questions
https://softcodel.blogspot.com/

Reply
avatar
Anonymous
admin
23 April 2022 at 20:55 ×

No more live link in this comments field

Reply
avatar

ConversionConversion EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng