|
did you search before you post ?
I Wish the Life Had CTRL-Z
Wizard's First Rule : People are fool,they believe what they want to believe or what they afraid to believe
www.subaitech.blogspot.com
|
|
|
|
|
Hi,
Im not sure for how depth u except the answer, nor whether you have a layered architecture in place.
There are couples of ways of achiving this…
Let’s assume that I have database named TestDB and it has a Employee table which has, EmployeeNumber, Name and some other fields. My objective is to get the EmployeeIDs and Names and bind them to the control. The stored procedure ill be using is just a simple one as Select EmployeeNumber, Name from Employee and I will call this sp as Employee_Select.
Here is a quick way…
• Let’s configure a DataSource to your DropDownList.
When configuring a datasource, you need to select the database and connect to it and select the stored procedure you want to use to populate the data to the control. So here is the sample code for that.
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dsTestSource" DataTextField="Name"
DataValueField="EmployeeNumber">
</asp:DropDownList><asp:SqlDataSource ID="dsTestSource" runat="server" ConnectionString="<%$ ConnectionStrings:TestDBConnectionString %>"
SelectCommand="Employee_Select" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
Now let’s do it in a structured way…
1. Get the data from the Database.
a. Create a Sqlconnection object, and create a Sqlcommand and execute it agaist your database and use an adapter to fill the data to a DataTable.
Ex:
string sConnection = ConfigurationManager.ConnectionStrings["TestDBConnectionString"].ConnectionString;
SqlConnection Con = new SqlConnection(sConnection);
SqlCommand cmd = new SqlCommand();
cmd.Connection = Con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Employee_Select";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dtValues = new DataTable();
adp.Fill(dtValues);
2. Bind it to the control.
DropDownList1.DataSource = dtValues;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "EmployeeNumber";
DropDownList1.DataBind();
You may write the above code in a method and call it when you need to fill the control.
Hope its clear to you..
Thx,
Gayani
modified on Saturday, July 5, 2008 4:26 AM
|
|
|
|
|
Execute the stored procedure sp_databases in master database. Then bind the returned result( say its a datatable of name dt) with the dropdown list like this:
<DropDownList>.DataTextField="Database_Name";
<DropDownList>.DataValueField="Database_Name";
<DropDownList>.DataSource=dt;
<DropDownList>.DataBind();
Regards,
Wasif.
|
|
|
|
|
Hey any one know that how to convert .dll file into .cs or .vb files?
plz dont say that its not possible
|
|
|
|
|
Its done with the help of a decompiler. Although decompilers can fetch exact code, some dll`s can be obfuscated at compliation so that it becomes very difficult to decompile.
you can find more at
here[^]
These tools are mainly used for reverse engineering.
May i know why do u wan`t it.????
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hello friends
My aim is to show a please wait screen till the background work is done
For this i have used ajax update progress pannel
so i have placed a div in it now when the background is busy the div is visible but its behind my controls ..
if any one knows how to do this please let me know ..i am at the end of project
thanks
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
in "Style" collection of that DIV control , put "z-index" property value to some very high value like 500 or 1000. It will be visible.
z-index is a controls property avaiable into style collection of a control( like height, width.)
Thanks,
Arindam D Tewary
|
|
|
|
|
Hai,
I have an asp page,which has three other included files,
1.How can I convert this page into an asp.net page
2.Can I include an asp page with some global constants into an aspx page.
3.What are the common possibilities to include other aspx files into an aspx file?
Please help.
|
|
|
|
|
How to create web form at runtime?
|
|
|
|
|
ss2050 wrote: How to create web form at runtime?
Your question doesn't made any sense. You need to rephrase it. Read this[^]
|
|
|
|
|
I need to know that --"when i click on any button it automatically generate(create new web form) a seperate web form which doesnt exist in project anywhere.
|
|
|
|
|
ss2050 wrote: I need to know that --"when i click on any button it automatically generate(create new web form) a seperate web form which doesnt exist in project anywhere.
What is your actual requirement?
Have you ever seen this type of functionality in any website?
This is not better way to add form.
If you can explain your requirement the we can help you.
Regard
Khan
please don't forget to vote on the post that helped you.
|
|
|
|
|
ya i have seen such type of functionality in forums creation.
I know very well that it is possible.
If u know then tell me
|
|
|
|
|
Who told u that they create new pages dynamically and how did u identified that????
In ASP.NET its not only difficult, or rather i would say its impossible. Who will complile those pages??? Are u willing to develop an online complier...
First clear your DBMS basics of how data should be stored and retrived in such cases. Don`t just ask silly questions if you don`t have any idea about it.
When you fail to plan, you are planning to fail.
|
|
|
|
|
if you cant develop ur logic, stop arguing
just say u cant do.
And dont tell me dbms , data can be stored in many ways. When i will do this thing i will send it to ,just write ur email here. within 2 days i will send you code
|
|
|
|
|
Plz tell me is it possible to use fileupload control in asp.net without postback(without using ajex).as i have a foam in which there is two textbox and to fileupload control so i want to submit all the data at one button which is knows as submit button .ant want to retrive the data of textbox and file (images )at next page.
|
|
|
|
|
gaurav mangal wrote: Plz tell me is it possible to use fileupload control in asp.net without postback(without using ajex)
May be using Activex control. But it's a bad design.
gaurav mangal wrote: ant want to retrive the data of textbox and file (images )at next page.
you can use any of the method what I said to your last question.
|
|
|
|
|
how to call a javascript function in page load
i can call a javascript function on button click
but with out user interaction i.e in page load
how can we call/run a javascript function
thanks in advance
vijay
|
|
|
|
|
Rgister the script using ClientScript.RegisterStartupScript() . Supply the JS function name as parameter. See the documentation[^]
|
|
|
|
|
make a function in jave script and all the java script code submit in that function.after that call it at page load by using this.
button.attribute.add("onclick","function()");
in place of button may be any control like textbox .
and function name in place of function ().
ok i am sure it will work
|
|
|
|
|
how to create a number of textboxes dynamically and how to retrive the value of these textbox at nextpage
actually i have some textbox :
child
Name of the daughter/son:
Date of issue:
Place of issue:
Date of expiry:
Date of birth:
Seat preference:
Meal preference:
Paste your picture :
all have one textbox .i want to generate no. of the entries this is for one child .i want a user select 3 from dropdownlist and 24 textbox should be on next page .and after enter the details of children .all data should be retrive at nextpage.
plz suggest me what should i do.
thanks
|
|
|
|
|
gaurav mangal wrote: how to create a number of textboxes dynamically and how to retrive the value of these textbox at nextpage
For creating dynamic controls, use GridView/Datagrid with template column and add rows to it. This is the easy way to do it without worrying about viewstate.
You got many ways to pass values from current page to next page. You can use cross page post back. Or store the data in a temporary location (a temporary table in the DB or a custom type in the session) and access it in the next page.
|
|
|
|
|
Thanks for the response.
actually i am using hidden fields for passing values from one page to other page.
& i want to generate a block of textboxes at run time as i have 4 textbox at tha page but now i want at run time when a user select 4 from dropdown then 16 textboxes generate at next page.
ok i have done it by using aspx page and by using aspx.cs page also .but when i use aspx page the id of the 5 th textbox is same to the first textbox .so how it is possible to retrive the values at next page.
so main problem is to generate the unique id for 5th textbox how is ti possible.
if any one know then tell me.
|
|
|
|
|
how to use upload control in asp.net.is it use without load button .or load the file without postback page.
|
|
|
|
|
gaurav mangal wrote: how to use upload control in asp.net
It's trivial. Just drag and drop control from toolbox.
|
|
|
|