I got 2 tables :-
TableName – Ques
QuesID|Ques|QuesAns|QuesTypeID|Active
TableName – QuesType
QuesTypeID|QuesType|Active
Now when I add a new question in my code, it first asks for QuesType then Ques and lastly Answer. What I want is that
when new record is added in DB,QuesTypeID column in Ques table should be set according to the value QuesTypeID in QuesType TAble.
Like lets say the QuesType user selects was “general Ques” and this type “General Ques” has ths QuesTypeID as 1 in QuesType Table.
Now what i want is that when new record is selected the column QuesTypeID be set as 1 in the Ques Table.
What changes do I need to make in the following SP ?
ALTER PROC [Admin].[sp_InsertUpdateQues]
(
@QuesID bigint,
@Ques nvarchar(1000)=null,
@QuesAns nvarchar(2000)=null,
@QuesTypeID bigint=null,
@Active bit=null
)
AS
BEGIN
END
END
Reading your question and comments I think you might be confused about the actual code calling the stored procedure.
The SP as written takes in a QuesTypeId, so there aren’t any changes that need to be done to it and instead you need to make sure the calling code is aware of how to get a QuesTypeId from a QuesType.
Now this gets us to the Telerik ComboBox. Each ComboBox Item has two properties, text and value. These two properties can either have the same or different values. The text property is shown to the user and value property is what is sent to the database. Thus, you can set the text property to QuesType and value to QuesTypeId and this is how the QuesTypeId is set.
The following link from the the Telerik documentation page shows how you can get at both the text and value properties of the selected ComboBox item by using:
radMenuComboItem1.ComboBoxElement.SelectedText
radMenuComboItem1.ComboBoxElement.SelectedValue