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
Rajaa Khalifeh
NA
53
6.5k
Pass grid-view Values even if column is not visible
Apr 21 2020 11:06 AM
hello i am trying to pass values from gridview to another form but my problem is that when i make the coloumn visible=false, data of this column is to showing up so any help how can i get value of coloumn even if the coloumn is unvisible..
my grid view data :
<ItemTemplate>
<asp:Button ID=
"Button1"
Text=
"Edit"
runat=
"server"
BorderStyle=
"None"
OnClick=
"Send"
ForeColor=
"CornflowerBlue"
CssClass=
"button1"
OnClientClick =
"SetTarget();"
Width=
"50px"
/>
</ItemTemplate>
</asp:TemplateField>
and on page load of this page :
protected
void
Page_Load(
object
sender, EventArgs e)
{
Label1.Visible =
false
;
if
(!IsPostBack)
BindGrid();
GridView1.Columns[0].Visible =
false
;
GridView1.Columns[1].Visible =
false
;
}
and the send edit button here i tried to show the coloumn and send the data with the button but it didnt work:
protected
void
Send(
object
sender, EventArgs e)
{
//Reference the Button.
Button btnSend = sender
as
Button;
//Reference the GridView Row.
GridViewRow row = btnSend.NamingContainer
as
GridViewRow;
//Save the GridView Row in Session.
GridView1.Columns[1].Visible =
true
;
Session[
"Row"
] = row;
//Redirect to other Page.
Response.Redirect(
"EditAddPack.aspx"
);
}
finally my another page load iam getting the data like this with all the columns that are only visible = true;
if
(Session[
"Row"
] !=
null
)
{
//Fetch the GridView Row from Session.
GridViewRow row = Session[
"Row"
]
as
GridViewRow;
//Fetch and display the Cell values.
editstdidlbl.Text = row.Cells[1].Text;
// here iam not getting this lable since i put it unvisible in the gridview
editCoachdroplist.SelectedValue = row.Cells[2].Text;
editSTDDropDownList.SelectedItem.Text = row.Cells[3].Text;
editSessiontxt.Text = row.Cells[4].Text;
editpackDropDownList.SelectedValue = row.Cells[5].Text;
editamounttxt.Text = row.Cells[6].Text;
editstarttxt.Text = row.Cells[7].Text;
editStatusDropDownList.SelectedValue = row.Cells[8].Text;
editremarkid.Value = row.Cells[9].Text;
}
Please Help!!
Reply
Answers (
2
)
What is the Main Difference Between Insert and Update?
Project Develop