|
hey Venk259,
thanks for getting back to me - have a feeling this should be a simple one, just needs the knowledge!
the 'dtr' is a SqlDataReader thats populated using a stored procedure:
Dim dtr As SqlDataReader
i then set the form fields with the values, for example:
txtUserName.Text = dtr.Item("username").ToString
which works for the 1st password field but not the 2nd!
hope that makes things a bit clearer, thanks for any suggestions,
jake
|
|
|
|
|
Hello friends...
Is it possible to use javascript with web controls instead of html controls? Suppose I am using a check box within datalist control. Is is possible to write javascript to check /uncheck checkboxes within datalist ..if a check box outside the datalist is checked / uncheckd?
|
|
|
|
|
// Outside the Datagrid
//this example is having two radiobuttons named with male, female and
// check box below the radiobuttons
function validate(form) {
// Checking if at least one period button is selected. Or not.
if (!document.form1.sex[0].checked && !document.form1.sex[1].checked){
alert("Please Select Sex");
return false;}
if(!document.form1.agree.checked){alert("Please Read the guidelines and check the box below");
return false; }
return true;
}
kishore kumar Manikonda
Software Developer
|
|
|
|
|
But what abt checkboxes within datalist. How to write script on checkbox within dataslit?
|
|
|
|
|
Hello programmers,
Any idea how to compute two time value in two textbox and display in label?
Bernie
|
|
|
|
|
Hi
Can you elaborate your exact requirement?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
i have 2 time dropdownlist, frmdrp and todrp, i just add collection to dropdown which is 8:30,9:00,9:30,10:00(completed to 24 hours)
For example i have selected 8:30 from the frmdrp then i select 12:30 from todrp.
After postback, the label will show the difference between the two time selected.
The result is:
label1="4" hour difference.
Can you help me with that?
Bernie
|
|
|
|
|
Hi,
You can use the following logic if it is applicable to your requirments.
DateTime dt1 = Convert.ToDateTime(frmdrp.SelectedValue);
DateTime dt2 = Convert.ToDateTime(todrp.SelectedValue);
TimeSpan ts = dt2 - dt1;
int totalhours = ts.Hours;
int totalmins = ts.Minutes;
label1.Text = totalhours.ToString() + ":" + totalmins.ToString();
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
-- modified at 5:19 Monday 30th April, 2007
|
|
|
|
|
Can you please do the code in visual basic not in C# code?
Thanks and God Bless!
Bernie
|
|
|
|
|
i got it..Thank yo very much i used DIM something like that.
God Bless you boy..
Ahh..
I have another question,
How can i insert multiple items from listbox in my table in database?
I have a category "Agents" on dropdownlist,
I have may names on my listbox,
If i click Insert it only insert 1 row not all the items inside my listbox.
Bernie
|
|
|
|
|
Hi,
You can do it like this.
ListItem litem = new ListItem();
litem.Text = drp.SelectedText;
litem.Value = drp.SelectedValue;
lstbox.Items.Add(litem);
The code above is the logic and you can implement in VB easily. Just syntax is the difference.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
How can i insert all the items in listbox into the database? multiple insert.
I can get all the items but its just inserting 1 row in that category.
drpcategory : Agent,Trainees
drpNames : Bernie, Ray,Kirby,John,Beejay
list1 : contains all the selected items on drpNames
table1 : my table in my database
my query now is
INSERT INTO table1(Category,Name)VALUES(@category,@name)
If list1box1 contains all the items from drpnames and i select "Agent" category on my drpcategory and i click the button insert, all the 4 items will be inserted in my database table(table1) on a single click.
Can you help me with that?
I am using detailsView and SQLdatasource
Bernie Leynes
|
|
|
|
|
Hi,
If you are creating seperate row for each of the item in the listbox then you have to loop through all the items and create intsert query in the loop and execute it.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
it works fine if i use dropdownlist, but in dropdownlist you will insert the data in the database individually right?.
I want to use listbox for me to insert all the data in a single click of the button.
God Bless you!
Bernie Leynes
|
|
|
|
|
HI,
I am not getting you exact requirement. Can you pelase elaborate by giving an example?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
ok. heres my example
I have 2 dropdown and a listbox and a table in my database
drpcategory
drpNames
listbox1
table1- the columns are Category,Name
I have items in drpcategory.
the items are:
Agent, Trainees
In my drpNames the items are :
Bernie, Ray, Kirby
listbox1.items= drpNames.selecteditem.text
If my listbox1 contains all the names from drpNames
and i select "Agent" from drpCategory then i click insert button all the 3 names on my listbox will be inserted but different row.
The result will be
Category Name
Agent Bernie
Agent Ray
Agent Kirby
My problem is even if i have multiple items in my listbox then after i click insert int only insert 1 row in my table which is the first row only
Bernie Leynes
|
|
|
|
|
hi,
See in this case the solution is what I have told you before. U have to loop through all the items in the listbox and create INSERT query for each of the item and execute it.
Can u send the code you have written?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
listbox1.items = drpNames.selecteditem.text
this is how i get the items from dropdown and display in listbox.
How can i Loop all the items from listbox?
If i do looping it will insert all the items from listbox in my table in the database?
Bernie Leynes
|
|
|
|
|
Hi,
The onel line of code u have given will not execute coz it will give compile time error.
yes i u loop through all items in the listbox it will all the items from the listbox in the table in database.
how do u try to insert data in the table in you database?
Please paste your code here.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Heres my code..
INSERT INTO table1(category,Name)VALUES(@category,@name)
category bind to drpcategory
name bind to listbox1
You are blessed men.
Thanks
Bernie Leynes
|
|
|
|
|
I know you know how to do that man. Please help me..
Thanks and God Bless
Bernie
|
|
|
|
|
HI,
I have asked you to paste your whole code here. but I dont think you want to do that. You are just pasting one or two lines and want me to do everything for you.
Things doesnt happen like that.
If you want to insert values from the listbox the commong logic is that you take items from the listbox one by one and create insert query for each of the item and execute the query.
foreach(ListItem LI in lstbox.Items)
{
string strquery = "Insert Into table Values ('" + ddl.SelectedValue + "', '" + LI.Value + "')";
cmd.executenonquery(strquery);
}
THis is the commong logic. You implement this as per your requirement.
If any further assistance is needed then do reply with the whole code u have written to insert the data in the table.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
im sori but i am using SQLDataSource thats why i have only one line of Code. I just bind the listbox on my textfield. I did not use the manual connection in code behind.
Any idea about that?. I already check the multiple selection but still insert 1 data per transaction
thank you
Bernie
|
|
|
|
|
hi again,
do you have any idea on how to create exam application in asp.net 2.0 web app?
Bernie
|
|
|
|
|
I have a problem in finding how many number of input parameters available in a Store procedure
Please help me
Thank you
Kishore Kumar Manikonda
kishore kumar Manikonda
|
|
|
|