TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deekshaa Singh Chauhan
NA
178
32.6k
how to check selected dropdown value is exists or not
May 7 2018 6:20 AM
How to check selected dropdown value is available in database
When we select commodity from dropdaown and this value is not in database with this warehouse it does not show any message .
protected
void
ddlCommodity_SelectedIndexChanged(
object
sender, EventArgs e)
{
Int64 Cmdty = Convert.ToInt64(ddlCommodity.SelectedItem.Value);
if
((Convert.ToInt32(ddlWarehouse.SelectedItem.Value)) != 0)
{
//int InsuranceId = Convert.ToInt32(grd.DataKeys[e.RowIndex].Values[0]);
string
constr = WebConfigurationManager.ConnectionStrings[
"WarehouseWebsiteString"
].ConnectionString;
using
(SqlConnection con =
new
SqlConnection(constr))
{
using
(SqlCommand cmd =
new
SqlCommand(
"Select CommodityId from tblCommodityonWarehouse WHERE WarehouseId = @WarehouseId"
))
{
cmd.Parameters.AddWithValue(
"@CommodityId"
, Cmdty);
cmd.Parameters.AddWithValue(
"@WarehouseId"
, ddlWarehouse.SelectedIndex);
cmd.Connection = con;
con.Open();
int
k = cmd.ExecuteNonQuery();
if
(k > 0)
{
string
popupScript =
"$.prompt('This Commodity is Not Available. Please use another.');"
;
ScriptManager.RegisterClientScriptBlock(
this
.Page,
this
.Page.GetType(),
"clientScript"
, popupScript,
true
);
ddlCommodity.SelectedIndex = -1;
}
//else
//{
//}
con.Close();
}
}
Reply
Answers (
6
)
OWIN and KATANA
How to use google calendar in asp.net