|
hu!!
now lets say you want to add these values after clicking btn under that event you simple write:
radiobtn1.text="20"
radiobtn2.text="30"
...........
..........
Now when you want to save these values in the database simply write a query
insert into tblanswers(ans1,ans2,ans3,ans4) values(radiobtn1.text, radiobtn2.text............)
Gautham
|
|
|
|
|
Mr.Gautham,Your not able to understand my question. Thank you very much. My problem is not yet solved.
|
|
|
|
|
Can you explain this in details.
I want to type the above 4 options during runtime
This is a wild guess… You want to dynamically display those values you’ve provided to a radio button on runtime? If I’m right!, here is the solution. Use the RadioButtonList controls instead the radiobutton control. See code below.
ListItem listItem1 = new ListItem("a.) 20","a");
ListItem listItem2 = new ListItem("b.) 30","b");
ListItem listItem3 = new ListItem("c.) 10","c");
ListItem listItem4 = new ListItem("d.) 50","d");
listItem3.Selected = true;
RadioButtonList1.Items.Add(listItem1);
RadioButtonList1.Items.Add(listItem2);
RadioButtonList1.Items.Add(listItem3);
RadioButtonList1.Items.Add(listItem4);
Or use data comming from database.
RadioButtonList1.DataSource = MyDataObject;
RadioButtonList1.DataValueField = "DataValueField";
RadioButtonList1.DataTextField = "DataTextField";
RadioButtonList1.DataBind();
and to get the user selected value
string userselectedvalue = RadioButtonList1.SelectedItem.Value
;
Then Save userselectedvalue variable value to the database.
Regards,
Mark
|
|
|
|
|
thank you very much mark,its working. Please help me with the Grid question which i have posted. Its urgent.
Thank you in advance.
|
|
|
|
|
hi to all,
i m working on project in which i have to add 2 C# pages in a HTML site(static site). i have done it on local machine .it running purfectally but when uploading it on server it givwes me error "Server Error in '/' Application." . please some body help me .
thanx in advance.
|
|
|
|
|
Does the server have the framework installed? Is it set up to run as an application configured for .net 2.0?
|
|
|
|
|
With customErrors off, what is the error it shows?
|
|
|
|
|
I want to display the values in the database, row wise in a Grid View. Please give me the code in C#.
|
|
|
|
|
|
i dont see any codings.
|
|
|
|
|
Ah yes, maybe I didn't explain enough. One has to use his/her initiative in order to be a succesfull developer. In this situation ones initiative would manifest itself as using the search functionality of said websites, or in the case of the latter have a browse round until you see something vaguely like what your looking for. OK?
|
|
|
|
|
I want to type text values in Radio Button during runtime,please tell me where i have to write the code and please give the code in C#.
|
|
|
|
|
Put this code on Page Load event handler
if(!Page.IsPostBack)
{
MyRadioButton.Text = "This is my radio button.";
}
|
|
|
|
|
Ive been using .net2 for a short while and have mastered the basics of using FormViews, DetailsViews and the like but I cant seem to see how to go about binding fields from a datasource to Labels?!
Can anyone please help, its driving me crazy?
Thanks
Adam
|
|
|
|
|
Didnt the DataBinder.Eval(Container.DataItem,"columnname") work???
Gautham
|
|
|
|
|
Thanks for the reply.
I dont know, how would i go about adding this? my heads in a right muddle! Id need to reference the datasource somewhere first though wouldnt i? How do I do this?
Adam
|
|
|
|
|
No Problem!!!
Lets say that you have a gridview1 and the datasource given to the gridview1 is ds!!
Assume that the resultant ds has a table with 5 rows and 3 columns col a, col b, col c.
No in your grid under the itemtemplate you would have added the label right!
there you would just include the binding logic
ex:
<itemtemplate>
<as:label id="label1" runat="server">DataBinder.Eval(Container.DataItem,"col a")
.......
.......
......
......
Gautham
|
|
|
|
|
Its not linked with a gridview or anything as an item template, that part i can do.
Basically what i want is that there is a list of records in a listbox. You then can select a record which will then close the listbox and populate some labels with the persons email, name etc.
This is so that I can easily pull these records as I will want to add these into the database as it is part of a wizard form i am building for people to fill in.
Hope this makes sense.
Thanks
Adam
|
|
|
|
|
Hi
There are lots of examples for form view using SQL Data Source. Here is an example to bind data in labels using VS.Net 2005 (C#.net 2.0)
Simply drag and drop SQL Data source in your application. Right click the Data source, click Configure Data Source. If this is the first time you are connecting to Database then Click New connection, Type Server Name, User Name & Password. Select database from the list after entering valid user name and password.
Connection String will be populated automatically in the list. Click next, select table from the list. You can modify your query later using the SELECT property of SQLDataSource.
If you don’t want SQLDatasource, you can add a connection string in Web.config and use the same. No need to worry about that now. You need to explore more on this.
For beginners, use SQL Data source. Try without DataSource later as most applications use Stored Procedures.
Now add Form or Details or Grid view in your application; go to DataSourceID property of the control (formview or detailsview or gridview). Select DataSourceID from the list as you have added in your application.
By default all fields will be bind automatically.
Just take a note: .net uses the following expression for binding text:
1. <%# DataBinder.Eval(Container.DataItem,"columnname"%> - for gridview
2. <%# Bind("Columnname") %> - for formview or detailsview
3. <%# Eval("Columnname") %> - for formview or detailsview
Try other controls like GridView. All the best
Rate this message. Thank you. Harini
|
|
|
|
|
Thanks for your reply.
BUt i wasnt looking to have the records in a form/details view as this would cause me problems on submitting the data as how would i find the actual labels within the controls when i want to submit the form?
|
|
|
|
|
Very simple e.g.,
<br />
myLabel.text = dataTable.Rows(0).Items(0)
It depends on what your datasource is...
|
|
|
|
|
Its a sqldatasource. What code would i need in to create the datatable from this in the first place?
Thanks
|
|
|
|
|
i have a grid view with a template columns .. i put a button in one of the template column .. i want put the data in the first cell of the selected row in a string when i click on the button .. how ??
|
|
|
|
|
This is the perfect link for your question. Check out!
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx
Gautham
|
|
|
|
|
i want to create a datatable from FileInfoCollection object .Can you help me out .
|
|
|
|