|
Where exactly are you getting the problem. In getting the selected value from the dropdowlist or in the sql query to insert the record?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Actually I'm getting the problem at the selected Item.
It's just that if that is fixed.. then the stored procedure may or may not work.
Both areas need testing. So i need to fix the first problem first.
Normally when I store details from a textbox, I just enter something like:
objUsers.Forname = System.Convert.ToString(Me.txtForename.Text) and relevant SQL Parameter coding.
but for the DropDownList, I was guessing it would be:
objUsers.UserTitleID = System.Convert.ToString(Me.ddlUserTitleID.SelectedItem.Value)?
In anycase, IF that line is infact correct, then my problem lies in the SQL parameters for the DropDownList:
Dim pmUserTitle As SqlParameter = New SqlParameter
pmUserTitle.ParameterName = "@UserTitleID"
pmUserTitle.SqlDbType = System.Data.SqlDbType.Int
pmUserTitle.Size = 10
pmUserTitle.Direction = System.Data.ParameterDirection.Input
pmUserTitle.Value = objUsers.UserTitleID
Thanks.
|
|
|
|
|
Dayekh wrote: objUsers.UserTitleID = System.Convert.ToString(Me.ddlUserTitleID.SelectedItem.Value)?
Here you are getting the value of the selected item. If you want to get the selected item's text the you have to do something like this:
ddlUserTitleID.SelectedItem.Text
Best Regards,
Apurva Kaushal
|
|
|
|
|
I tried that before the SelectedItem.Value
This is what it throws at me..
System.FormatException: Input string was not in a correct format.
I should be able to figure this out.. but your insight on possible causes will be very appreciated.
Perhaps the method of input is clashing with how I intend to store it.
|
|
|
|
|
Dayekh wrote: objUsers.UserTitleID = System.Convert.ToString(Me.ddlUserTitleID.SelectedItem.Value)?
In anycase, IF that line is infact correct, then my problem lies in the SQL parameters for the DropDownList:
Dim pmUserTitle As SqlParameter = New SqlParameter
pmUserTitle.ParameterName = "@UserTitleID"
pmUserTitle.SqlDbType = System.Data.SqlDbType.Int
pmUserTitle.Size = 10
pmUserTitle.Direction = System.Data.ParameterDirection.Input
pmUserTitle.Value = objUsers.UserTitleID
Try it like this:
objUsers.UserTitleID = System.Convert.ToInt(Me.ddlUserTitleID.SelectedItem.Value.ToString())
"if objUsers.UserTitleID is an integer value"
and rest you keep as same.
Best Regards,
Apurva Kaushal
|
|
|
|
|
hmmm...
The same error is thrown out .. eventhough objUsers.UserTitleID is declared as Integer .. lol.
In anycase, your help is much appreciated. Do post more suggestions if you feel like it.
Thank you.
|
|
|
|
|
hahahah..
I could not stop kicking myself and laughing..
My Stored Procedure referred to a "User" table... but the table was actually called "Users"..
Please LEARN from my mistake ppl.. LOOK at the references a million times over... if nothing is fixed.. SLEEP and then look at them again!
It works fine now.. thanks for your suggestion.
|
|
|
|
|
Happens sometimes...
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
Any one suggest me, I am doing an event project, in this i am trying to store the event based on the date, when the user open's the calender to view the events based on the date, the dates in the calendar control should be Clickable only if that specified date contains any event in the database, else that date should not be an Clickable one.How to do this?? Can any one suggest me to do this??? I tried to change the IsSelectable = False, but all the dates become as simple text not as an link
Can any one suggest me how to do this???
Thanks in advance
Bye
Exelio
|
|
|
|
|
HI,
HOW TO USE TEXTCHANGED EVENT FOR A TEXTBOX WHICH IS INSIDE THE DATAGRID
KAVITHA
|
|
|
|
|
Hi kavitha,
Select the html view of the datagrid. In the tag of textbox specify a function to the ‘OnTextChanged’ event and set the ‘AutoPostBack’ is to True. Like this.
<asp:TextBox id="txt" runat="server" OnTextChanged="fun" AutoPostBack="True"></asp:TextBox>
Then write the ‘fun’ function in the code behind file.
Public Sub fun(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Your Code
End sub
Thomas
|
|
|
|
|
Hello All,
I need to do client side automation of PowerPoint.Can somebody please help me out? Any pointers to this will also be helpful.
Thanks,
Avanika
Thanks,
Avanika
|
|
|
|
|
|
Guys,
When I try to test string.substring(n,i) I get ArgumentOutOfRangeException exception for some other values of the substring. The reason is that I sometimes test a string that is smaller than the range given or even null. I need to keep on testing that in my program. How do I handle this exception so that I keep on executing without throwing this exception.
Urgent, please help.
Vilunjike.
manv
|
|
|
|
|
You need to check the length of the string prior to that piece of code.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Yes of course, I have been doing that. However, it's cumbersome. I thought I can suppress the dialog box of the exception by passing some values to the properties of the thrown exception and continue execution, is there any way?
manv
|
|
|
|
|
hello
any body knows how to implement a payment through 2checkout.com in asp.net.
i have did it with paypal but how to do it with checkout.com
thanx
|
|
|
|
|
I am new to asp.net anybody plz help me how to set cursor in the textbox when i press left mouse on textbox using javascript.
E-Ramu
|
|
|
|
|
What you want to do, do you want to set the focus to the textbox or something else?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Initially i have an empty textbox and it doesnt have focus.i want to place cursor in the textbox when i click on the textbox
E-Ramu
|
|
|
|
|
Whenever you will click on the textbox the cursor will automatically come the textbox.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi Ramu,
To set a focus when web page is loaded you can use a BODY onload event and javascript client code.
Have a web form with ID="Form1" with some controls, including a textbox named TextBox1. To set a focus to TextBox1 when page is loaded you can use this javascript code:
<body onload ="javascript:document.Form1.TextBox1.focus();">
Page.RegisterStartupScript("SetFocus", "document.getElementById('" + TextBox1.ClientID + "').focus();");
ASP.NET 2.0 simplified this problem and introduce a concept of "default focus". There is a new DefaultFocus attribute that allows you to easily set focus to desired controls. The sample HTML code bellow will set focus on control named textbox1:
<form id="Form1" defaultfocus="textbox" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:textbox id="textbox2" runat="server"/>
<asp:button id="button1" text="Button1" runat="server"/>
</form>
-- modified at 6:10 Tuesday 22nd August, 2006
with regards
Satips
|
|
|
|
|
In the Page_Load Event, Type in
txtreset.Attributes("OnFocus") = "document.Form1.txtreset.value='';"
Thanks & Regards,
Suresh Dayma
|
|
|
|
|
JavaScript: How to convert string to date and Compare two dates.
eg. If date1 is 08/18/06 and date2 is 08/19/06
Then it should give alert that "Date2 is greated than Date1:"
|
|
|
|
|