Can that be easily done? I have a lot of controls in page1 and page2.
Desmond Lim
Posts
-
To ensure that users come from page1 before going to page2 -
To ensure that users come from page1 before going to page2Hi guys, I'm wondering if it there is a better way of doing this, I have 2 webpages, page1 and page2. I want to ensure that users would go to page1 before going to page2 (a button on page1, redirects it to page2), so that if the user types in the URL of page2, it will redirect to page1 first. I am currently using the
Request.UrlReferrer.ToString()
to get the the previous webpage and comparing it. If it is from page1 then page2 will open if not it will redirect to page1 (the code is below). I'm just wondering if there is a better way of doing this? Thanks.protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.UrlReferrer.ToString() != "page1")
{
Response.Redirect("page1");
}
}
} -
Display different ToolTip message in different parts of the same DataGridView controlHi, I'm trying to do this and am wondering if it is possible. I have a DataGridView control. I would like the ToolTip message to show some data (on the DataGridView itself) when the cursor is over that particular row in the control. If the cursor is out side the data rows but within the control (i.e. in the parts that have no data), I would like it to show another message. I have tried this.
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1 && ds.Information.Rows[e.RowIndex]["Value"] != null)
{
this.grid.CurrentCell.ToolTipText = ds.Information.Rows[e.RowIndex]["Value"].ToString();
}
else
{
toolTip.Show("Right-click to display menu", this.grid);
}
}What do I have to do to get it working? Thanks.
modified on Wednesday, November 26, 2008 8:55 PM
-
Adding rows to DataGridView programmaticallyHi, Project ------- I have this list box that will get a list of items from a database. Upon choosing an item, it will populate the DataGridView with the data, this data is different for different items, e.g. one might have a size field and another wouldn't or an item might have 5 entries but another 9, etc. This populated data is from a table that has a unique ID (key), the field name, the field value and the foreign key to link to the item table. Problem 1 --------- Currently, I'm trying to add an item into the database, how can I create a DataGridView that would allow me to add rows to it. If I bind it to a table I get the error that table.rows.add() is not allowed on a bound DataGridView. I have to presume that I can just unbind the table and add the rows of data manually. I'm wondering if there is an easier way of doing it. Problem 2 --------- Further to the above, if I want to edit an item, how can I go about adding a new row if the columns are bound. I require (during editing) that columns because more than 1 user might be editing the same item at the same time. How would I go about doing this? Anyone has any article to point me to? Thanks. Desmond
-
GridView to DetailsView (on a different page), passing of variableThanks Venkatesh
-
GridView to DetailsView (on a different page), passing of variableHi, I'm trying to get the key of the GridView into the DetailsView and using Session doesn't seem to work. The GridView (Parent page) has summaries of the data. I'm using a to get the ID and redirect to the DetailsView page (Child page). 2 different pages. What I'm currently doing is this protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Session["ID"] = GridView1.Rows[0].ToString(); Response.Redirect("DetailsPage.aspx"); } And the DetailsPage has this for getting the parameter I know the problem is that the data types are incompatible but how can I cast the data? Or is the problem more than that. If this is the wrong way, how can I pass the ID from the parent to the child (different pages)? And I don't want to put the data in the URL. Thanks. Desmond
-
DetailsView -> getting immediately into insert/edit mode when page loadsWasif Ehsan wrote:
1. Set the default mode of the detailview to 'Insert'. 2. Yes its possible by manipulating any appropriate event like OnItemCommand.
Thanks a million. 1 works now. but I have no idea how to go about doing 2. Do you have an example or something that I can read? Thanks. Desmond
-
DetailsView -> getting immediately into insert/edit mode when page loadsHi guys, I'm wondering of these are possible: 1) I have a asp.net page that has a DetailsView in it. When the page loads it would load the 1st record in the database (which is fine). I have also "activated" the new (insert) button. Is there a way for asp.net to auto activate the new? I mean, when the page loads, can it be in the "insert" mode immediately instead of the details display mode? 2) Also, is it possible to allow the user to select a record from a GridView and then have the page redirect to another page where it is in edit mode? i.e. upon clicking select in GridView, another page is open where it is in edit mode for that record selected? If not, is there another way of doing this? Like creating a edit page where the user has to enter the record s/n they want to edit and have the DetailsView brought up in edit mode? Thanks. Desmond
-
Creating a drop down list (databounded) and adding a "Please Select"Hi, I'm wondering if this can be done. I have a drop down list that I populate with data from a table. I'd like to add a "Please Select" to the drop down list and make it the first item on the list, so that when the page is loaded, the user will see "Please Select" instead of "amp" in the drop down list. Can this be done? If so how? Thanks. Desmond
-
Create a grid of radiobutton on the flyI'm creating a software that allows the user to enter data for research purposes. The slide/grid they use comes in different sizes, 20x30, 40x40, 100x30, etc. They want to be able to choose the size (by list box) and when a particular size is chosen, the grid of radio buttons corresponding to the size that they want will be created i.e. if they choose 20x30, 20 columns by 30 rows of radio buttons will be created. The radio buttons will then be use to enter the data that corresponds to that part of the grid, that is to say, when the user clicks the Col 2 and Row 3 radio button, a window might pop up with the information needed for that part. Which means that each individual radio button has to be identifiable. So back to my question how do you do a create radio button with different IDs because I know that when you do a RadioButton rb01 = new RadioButton(); it creates the radio button object, I just don't know how to create radio buttons that have different IDs, i.e. rb01, rb02, rb03, etc. via using a loop. I know that if I do something like
for (int i = 0; i < 1000; i++) { RadioButton rbNew = new RadioButton(); (move rbNew to a particular x y coordinate); rbNew.name = "rb01"; }
This doesn't seem to work for I only get 1 radio button. If you can think another way to do this, I'll really appreciate it. Thanks. Desmond -
Create a grid of radiobutton on the flySorry Gareth, that's not want I wanted. I know I can do it that way but what if I have 1000 radio buttons I want to create, RadioButton rb_1_1 = new RadioButton(); RadioButton rb_1_2 = new RadioButton(); and so on for 1000 times. Is there a way to do it programmatically, so that I can just create a for loop and it creates the radio buttons for me? And I need to do this in windows not ASP.net (I can do it in ASP.net). Thanks. Desmond
-
Create a grid of radiobutton on the flyHi, I have this problem that requires different areas (30x40, 10x40) of radio buttons. How can I do this on the fly? I can't figure out how can I create the radio buttons and add them to the panel using a for loop? I want to name the radio buttons rb_1_1, rb_1_2 or rb11, rb12, etc. I know I have to create the radio button objects -> RadioButton rb_1_1 = new RadioButton() but how would I change the rb_1_1 when it loops again? Thanks. Desmond
-
Deploying database with windows application [modified]Hi, I have a database application and am trying to add it to the windows application deployment (using setup and deployment -> setup project). How do I go about doing it? I want the installation application to install the windows application, mssql express and the database associated with the windows application. I have done the windows application and mssql express part but I can't seem to find a way to add the database associated with the application. Can anyone help me? Thanks. Desmond
modified on Wednesday, January 30, 2008 11:34:14 PM
-
Connecting Strings on C# (using visual studio) - making it general/genericHi, I have a problem that connects to my database (on the same machine) using the usual c#/vs connectionString. When I publish it, that string is still the same (i.e. the name of the machine doesn't change). Yea, I think I've hardcoded the connectionString. But how can I softcode it using VS? How can I make it so that the connectionString takes the name of the current machine it is residing on or better, the application would prompt for where the database is. Any help is appreciated? Or even just point me to articles. Thanks.