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
Ms_ Dev
NA
236
92.1k
Item doesnot exist in current context.
Feb 8 2017 1:10 AM
Hi.
I have the following code.
private
void
GetItemsPageWise(
int
pageIndex)
{
string
conString = ConfigurationManager.ConnectionStrings[
"FileStoreEntities"
].ConnectionString;
using
(SqlConnection con =
new
SqlConnection(conString))
{
using
(SqlCommand cmd =
new
SqlCommand(
"GetItems"
, con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(
"@PageIndex"
, pageIndex);
cmd.Parameters.AddWithValue(
"@PageSize"
,
int
.Parse(itemddlPageSize.SelectedValue));
cmd.Parameters.Add(
"@RecordCount"
, SqlDbType.Int, 4);
cmd.Parameters[
"@RecordCount"
].Direction = ParameterDirection.Output;
con.Open();
IDataReader idr = cmd.ExecuteReader();
ItemView.DataSource = idr;
ItemView.DataBind();
idr.Close();
con.Close();
int
recordCount = Convert.ToInt32(cmd.Parameters[
"@RecordCount"
].Value);
this
.PopulatePager(recordCount, pageIndex);
}
}
}
and the aspx as -
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
PageSize:
<
asp:DropDownList
ID
=
"itemddlPageSize"
runat
=
"server"
AutoPostBack
=
"true"
OnSelectedIndexChanged
=
"PageSize_Changed"
>
<
asp:ListItem
Text
=
"10"
Value
=
"10"
/>
<
asp:ListItem
Text
=
"25"
Value
=
"25"
/>
<
asp:ListItem
Text
=
"50"
Value
=
"50"
/>
</
asp:DropDownList
>
<
hr
/>
<
asp:GridView
ID
=
"ItemView"
runat
=
"server"
AutoGenerateColumns
=
"False"
>
<
Columns
>
<
asp:BoundField
DataField
=
"ID"
HeaderText
=
"ID"
InsertVisible
=
"False"
ReadOnly
=
"True"
/>
<
asp:BoundField
DataField
=
"Name"
HeaderText
=
"Name"
/>
<
asp:BoundField
DataField
=
"Cost"
HeaderText
=
"Cost"
/>
<
asp:BoundField
DataField
=
"Image"
HeaderText
=
"Image"
/>
<
asp:BoundField
DataField
=
"Description"
HeaderText
=
"Description"
/>
<
asp:BoundField
DataField
=
"AddedBy"
HeaderText
=
"AddedBy"
/>
</
Columns
>
</
asp:GridView
>
I am getting error for Gridview, Dropdown and Repeater. it is coming as item dowsnot exist in current context.
PLease help to resolve.
Thanks.
Reply
Answers (
1
)
Date time convertion error
Google API to access Delegated mail box email