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
Gagan Gautam
NA
140
15k
Retive Gridview Data Row by row and store in variable
Dec 9 2016 12:48 PM
Hi,
I am using GridView AutogenrateColumn=False .This is my Gridview code
______________________________________________________________________
<asp:GridView ID="gridview1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="Ischeck" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Id">
<ItemTemplate>
<asp:Label ID="id" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Product Name">
<ItemTemplate>
<asp:Label ID="lblPrductName" runat="server" Text='<%#Eval("ProductName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="lblObjName" runat="server" Text='<%#Eval("ObjName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quantity">
<ItemTemplate>
<asp:Label ID="lblQuantity" runat="server" Text='<%#Eval("Quantity") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
_____________________________________________
Now i am retrive data of grid view row by row.,So this is my code,In this code i am retriveing data in two ways but i am not able retive data.Plzz help me
_________________________________________________
protected void btn_Click(object sender, EventArgs e)
{
foreach (GridViewRow item in gridview1.Rows)
{
string name = item.Cells[2].Text.ToString(); // 1st way
var nn =(Label) item.FindControl("ProductName"); //2nd Way
}
}
Reply
Answers (
1
)
Show search data from search box in masterpage to other page
How to check user status still login by using User.Identity.