Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Item doesnot exist in current context.
Rp Singh
Feb 8 2017 1:10 AM
234
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Date time convertion error
Google API to access Delegated mail box email