|
U will have to use the event RowCommand of GridView and use this to get the values:
GridViewRow oGridViewRow;
if(e.CommandName == "Edit")
{
Int32 index = Convert.ToInt32(e.CommandArgument);
oGridViewRow = GridView1.Rows[index];
TextBox1.Text = oGridViewRow.Cells[1].Text;
TextBox2Text = oGridViewRow.Cells[2].Text;
}
Hope this helps u?
|
|
|
|
|
sir its working if and only the eidt row select in properties is set to true ...but the edit option should not shown in the gride view simple by selecting the row with the mouse the row should be selected in the grid view and the values shouls be retrived
|
|
|
|
|
Can u please post ur code what exactly u r doing???
|
|
|
|
|
sir iam having grid view with some data in it .now my aim is if i select any row in the grid view that selected row values should be retrived. ur solutioon is working iff we enable auto generate row =true
|
|
|
|
|
I dont think there anything called autogeneraterow which u r saying I think theer is something autogeneratecolumns. What exactly do u mean by select any row in the gridview, how u r selecting the row??????
|
|
|
|
|
sorry its auto generate edit
|
|
|
|
|
Can u please post ur aspx code so that I can help u in a better way????
|
|
|
|
|
public partial class _Default : System.Web.UI.Page
{
DataTable dt ;
DataColumn dcindex;
DataColumn dcname;
DataRow dr;
protected void Page_Load(object sender, EventArgs e)
{
txtname.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btngetdata.UniqueID + "').click();return false;}} else {return true}; ");
if (IsPostBack == false)
{
for (int i = 0; i < 4; i++)
{
ddl.Items.Add("index" + (i + 1));
}
ddl.SelectedIndex = 1;
}
txtname.Focus();
txtname.Focus();
Panel2.Visible = false;
}
protected void message1(string msg)
{
Label lbl = new Label();
lbl.Text = "window.alert('" + msg + "')";
Page.Controls.Add(lbl);
}
protected void btngetdata_Click(object sender, EventArgs e)
{
try
{
Panel2.Visible = true;
txtname.Focus();
if (ddl.SelectedIndex >= 4)
ddl.SelectedIndex = 4;
if ((ViewState["datatable"]) == null)
{
dt = new DataTable();
dcindex = new DataColumn("index", typeof(string));
dcname = new DataColumn("name", typeof(string));
dt.Columns.Add(dcindex);
dt.Columns.Add(dcname);
}
else
dt = (DataTable)ViewState["datatable"];
dr = dt.NewRow();
if (ddl.SelectedIndex == 0 || txtname.Text == "")
{
message1("Either u have not selected index value nor NameField is empty");
}
else
{
dr["index"] = ddl.SelectedItem.ToString();
dr["name"] = txtname.Text;
dt.Rows.Add(dr);
gv.DataSource = dt;
gv.DataBind();
txtname.Text = "";
ViewState["datatable"] = dt;
if (ddl.SelectedIndex < 4)
ddl.SelectedIndex = ddl.SelectedIndex + 1;
else
{
ddl.SelectedIndex = 1;
}
}
}
catch (Exception ee)
{
Response.Write(ee.Message);
}
}
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
Panel2.Visible = true;
txtname.Focus();
if(txtname.Text !="")
Panel2.Visible = true;
}
i kept one drop downlist and text box whern ever i select index and write name in the textbox it should get in the grideview and when ever i select some row in the grid view it should get in the drop down list and textbox
|
|
|
|
|
I think u want the dropdownlist and textbox inside GridView?? If that is so then u will have to use Template Column of GridView. Take help of the following Link : www.gridviewguy.com/Articles.aspx
|
|
|
|
|
I have been looking on Google for a while now looking for the scope of the Session object. A few sites touch base on the subject and then go straight to global variables and other random things.
What is the scope of a session object?
I have a frames page, containing 4 frames, all aspx pages. If I create a session object in one page, can I access that data on another one of those pages using the session object?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Session Object's have session level(User level) scope. It allows to access the session values in all the pages for the entire User session.
Regards - J O H N -
|
|
|
|
|
So Response.Redirects and any page changing at all with not destroy the Session contents for the life of the Session object(default 20 minutes)?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
|
Hi,
I have a ASP.NET 1.1 application in which there are pages to add/update records. The problem is that when pages are loaded they are being stored in browser cache. Users are able to load them from their cache and perform add operations. So i require two solutions.
a) These pages should not be stored in cache without touching client browser settings, as i can currently change their settings to get new page every time but this is not acceptable.
b) If thats not possible, then how can i detect whether they have clicked the add button using original page and not cached page.
Regards
Shajeel
|
|
|
|
|
|
You can do as Michael said or you can use the following code in the code-behind to do the same.
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Regards - J O H N -
|
|
|
|
|
thank you both of you
Regards
Shajeel
|
|
|
|
|
When i create a new project in a location which i given, tghe solution file is saving in a default location C:\Documents and Settings\yesuprakash\My Documents\Visual Studio 2005\Projects\...
the other files are saved in the location which i given.
How can i save all files in a same folder.
Thanks and Regards
Yesuprakash
|
|
|
|
|
You can change the default location for saving .sln file.. Tool => Options => Projects and Solution => General => Visual studio project location..
Actually, it's not really a big problem.. You can manually "save as" the .sln in the location that you want. Another thing is that .sln is not very important for web project because you can open the webproject directly from the File-system in VS 2005.
|
|
|
|
|
i have a question ???????
i have 4 html button in my home page with one default active one
when i choose any other button it become the active one and display a certain photo
but when i make refresh to the page it reloads with the default button as the active one ignoring the last choise which i have made
i want the page to be reloaded with the last choise button not the default button
how can i do that ????????
i hope that my question is clear
Thanks ,
LA ELAH ELA ALLAH MOHAMED RASOL ALLAH
|
|
|
|
|
You have to store the selection somewhere, like a cookie, or your database. Then you have to read the value and change your page to reflect the choice.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ok the choise happend on client side the server has no idea about it so i need by using java script to creat a cooki and save the user choise in it and send it to the server how can i create cooki by using java script
LA ELAH ELA ALLAH MOHAMED RASOL ALLAH
|
|
|
|
|
Hi all, I promise I've tried to avoid adding chatter here by doing my home work, but am kind of perplexed. I have come to the conclusion that Master Pages are not at all what I thought they were, but don't want to abandon them in the event I am wrong.
I have a large 1.1 site that I have been putting off migrating for too long, it consists of a wrapper page, default.aspx, which is primarily made up of menus (as well as home page type stuff) and an iframe object that takes up most of the real estate. That iframe displays the approximately 130 individual pages of the application, whose navigation is driven by the menus and submenus surrounding the iframe (with some cross-child page navigation as well).
It works well except for a few very unelegant methods of having my “child” pages interact with the “parent” (default.aspx). So, I am looking at Master Pages. But, as best as I can tell, this is not really their purpose or even the concept. I obviously need for a single contentholder control to be able to cycle between 130 different content pages. I’ve not seen one article written by MS or the experts that even hint at doing that, and no users writing for help that have mentioned such a problem.
Advice is appreciated, I have been playing around with making them work anyway, and already encountered some odd behavior, but I will spare you commentary on that for now.
Thank you for your time,
nowensone.
|
|
|
|
|
The point of a master page is to create reusable content. If you have 130 content pages, the most obvious way to do this, would be to create 130 pages that all use the same master page. The advantage is entirely that you have one place to change the parts of your UI that appear on all pages. Not sure if this is what you were hoping for - master pages are not going to work in the way you seem to be describing ( one aspx which links to a bunch of other pages ). Those other pages are instead going to use the master page.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That is (in a nutshell) what is happening now functionally, and exactly what I have been attempting to do with Master pages. Which presented me with two different problems.
One, the single content holder that the 130 different pages will all reference, and more importantly, how do I programmatically reassign the various pages/content controls to the contentholder on the master?
And two, I began by creating individual content pages (since they each logically represent a page), but their particular content did not show up on the master. They were properly referenced and created, I started out utterly simple so as not to make mistakes. That is, they did not show up until I abandoned this approach and put the multiple content areas into the application entry page default.aspx. But it does not seem right to have one gargantuan page of content for the 130 different logical pages. I have many pages that contain several thousand lines of code and html each.
I'm sure that I am doing something more fundamentally wrong than programmatically, however it's been impossible to troubleshoot since I have not ran across a single example online or via several Asp.net 2.0 books that have a contentholder on a master page being used by multiple content areas/pages.
Thank you for the quick response.
|
|
|
|