I agree with you too...it's horrible.... and since we both agree on this issue, there is a little chance that you'll also agree that some people always see the glass as half empty...... I chose not to be one of them. Finally thank you Alan N for helping me out.
skhan17
Posts
-
Repositioning the cursor -
Repositioning the cursorTHANK YOU SO MUCH..... although I have figured out a manual way.... but this works like a charm....
-
Repositioning the cursorI don't know how to use focus.....can you please let me know how to use mouse focus... then I can use it..maybe
-
Repositioning the cursorwell it doesn't let me add that... i have tried that... it says : Error 1 'System.Windows.Forms.ToolStripMenuItem' does not contain a definition for 'PointToClient' and no extension method 'PointToClient' accepting a first argument of type 'System.Windows.Forms.ToolStripMenuItem' could be found (are you missing a using directive or an assembly reference?) I am sure that the child menu item has been shown before that.... please help.... Thanks for replying......
-
Repositioning the cursorIt doesn't matter if it's hostile or not, I need it now for some reason... let's just say all the supervisors in the MSc. program are crazy...... if you know a solution please help me ...otherwise please mind your own business....
-
Repositioning the cursorHello, I am looking for ways to reposition the cursor when I am clicked on the first menu item from a form menu. It should create a jumping effect so the user doesn't have to scroll through the other menus which don't have a child menu. for example.... one file menu has 4 items. Namely 1, 2, 3, 4 now only item 2 has child menu items. namely 2.1, 2.2, 2.3. I want the cursor to be on 2.1 when the user brings the mouse on 2. Please let me know how to do that. I am trying the following:
private void toolStripMenuItem2_MouseHover(object sender, EventArgs e)
{
toolStripMenuItem2.ShowDropDown();
Point LocalMousePosition_1 = this.PointToClient(Cursor.Position);
System.Windows.Forms.Cursor.Position = new Point(500, 500); //This just repositions the cursor to 500,500 position but not in the net child menu. This is where I am stuck.//Point LocalMousePosition\_2 = toolStripMenuItem2\_1.PointToClient(Cursor.Position); MessageBox.Show(LocalMousePosition\_1+"Happy New Year to DOTNETSPIDER.COM guys"); }
-
How to insert/update a row/cell in datagrid?What exactly did you mean by overriding the dataBind()?
-
How to insert/update a row/cell in datagrid?If you have read the code correctly, then you should notice that I have a string type 'dateString1' variable, which holds the string value of a date type data row from the datagrid**[string dateString1 = r["First_Resurvey_Date"].ToString(); ]. My understanding could be wrong. And then there is a DateTime type variable 'dateTime', which holds the DateTime type value of the String dateString1.[DateTime dateTime=Convert.ToDateTime(dateString1);]. And then the string array dateStringArray contains various date formats of the 'dateTime' variable from which I need to display [6].[string [] dateStringArray= dateTime.GetDateTimeFormats(); ]** I do understand that the formatting doesn't change the datarow from the datagrid. Now once I have got a specific format of the date I want to display to the user, I was looking for a way to display that specific format into the datagrid. Please let me know if there is any way to do that, I hope I conveyed correctly what I want to do. Thanks in advance.
-
How to insert/update a row/cell in datagrid?I don't understand how to update the row into the Datagrid to display a specific date format ??
[ds is my dataset]
foreach (DataRow r in ds.Tables[0].Rows)
{
string dateString1 = r["First_Resurvey_Date"].ToString();
DateTime dateTime=Convert.ToDateTime(dateString1);
string [] dateStringArray= dateTime.GetDateTimeFormats();r\["First\_Resurvey\_Date"\]= dateStringArray\[6\]; **\[This doesn't work, I cannot just assign the specific value to a datagrid row/cell......I need help on how to do that\] \[dateStringArray\[6\], gives the date format as dd-MMM-YY, which is how I want to display my date in the application\]** NotesLabel.Text= dateStringArray\[6\]; NotesLabel.Visible=true;
}
DataView view = ds.Tables[0].DefaultView;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = true; -
Date Format in C#Hello, I am using a MSAccess database date entered into the database are Medium date format ie. dd-mmm-yy format. But when the data is pulled from the db and shown into a datagrid, it's like mm/dd/yyyy hh:mm:ss. But I want only the medium date that is dd-mm-yy format(18-Aug-09). Please help. Thanks in advance.
-
[Message Deleted]Thank you all for your suggestion and very strong criticism. This is posted in ASP.NET as well and I don't want to have any reply anymore. Thanks again.
-
Dropdown list value is not retaining on page post back [modified]Thank you Mr. Sur. I knew that the culprit is the page load method.. but didn't know how to populate the second dropdown list without the pageload. Should I put the code you mentioned exactly inside the Specific_Query_DDL_selectedIndexChanged function ? And should I call that function inside the page_Load function? Please suggest. Thanks in advance.
-
[Message Deleted]private void Page_Load(object sender, System.EventArgs e) { if (this.IsPostBack) { getMLNO(Specific_Query_DDL.SelectedItem.Value); //This is where I am generating all the values from the DB for the second dropdown list. And as it's getting post back so even if I click submit button then the page gets post back and the selected value for the second dropdown list gets set to the default value, which is ANY } } private void getMLNO(string selectedvalue) //This is the method where all the MLNOs are generated { if(selectedvalue=="ResistantL") { string sql= "SELECT re_MLNO, MAX(re_SpecimenDate)-MIN(re_SpecimenDate) AS DaysSeronegative FROM ml_hiv_status WHERE (re_HIV1_Status=0) GROUP BY re_MLNO"; OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECTION_STRING); OleDbDataAdapter adapter = new OleDbDataAdapter(); OleDbCommand command = new OleDbCommand(sql, connection); DataSet ds = new DataSet(); adapter.SelectCommand = command; if (adapter.Fill(ds) > 0) { DataView view = ds.Tables[0].DefaultView; mlno_DDL.DataSource = view; mlno_DDL.DataValueField="re_MLNO"; mlno_DDL.DataTextField = "re_MLNO"; mlno_DDL.DataBind(); resultsLabel.Visible= true; mlno_DDL.Items.Insert(0, "ANY"); } connection.Close(); } } private void mlno_DDL_SelectedIndexChanged(object sender, System.EventArgs e) { } private void submitButton_Click(object sender, System.EventArgs e) //SubmitButton_Click method fetches all the data from the Database depending on the 2 values selected from the 2 dropdown list { if(Specific_Query_DDL.SelectedItem.Value=="ResistantL") { if(mlno_DDL.SelectedItem.Value=="ANY") //All the values from the Db are pulled if ANY is chosen from the second DDL { executeResistantListQuery_ANY(); } else if(mlno_DDL.SelectedItem.Value!="ANY") //Data are pulled if a specific MLNO is chosen from the DB, and this one is not
-
[Message Deleted]I am sorry for posting it here...I am deleting the post from here....and to my defense I would say that I thought this much code would be needed to see what I am trying to do here. Though it might seem to be a very unprofessional way to some of us.
-
Dropdown list value is not retaining on page post back [modified]Dear all, I am having problem with placing the proper condition inside the postback method. I am trying to do the following: 1. There are 2 dropdown lists in my program. 2. I have two DropDownLists databound on the webform. The autopostback of the first dropdown list control is set to true. The contents of the first dropdown list is hardcoded. The contents of the second depend on the selected item in the first. In other words: The selectedvalue of the first DropDownList is passed as a parameter for the query at the basis of the second DropDownList's datasource. And this works: Whenever I click on an item in the first DropDownList, the dependant items are shown in the second DropDownList. 3. If I click submit then the specific rows from the DB will be pulled based on the values selected from dropdown list 1 and dropdown list 2. Problem: In the postback method I think all the times the "ANY" MLNO is selected instead of selecting a specific value from the dropdown list 2. And that's why always all the values are pulled from the DB. The code is as follows: Code:
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Globalization;namespace HIV
{
/// <summary>
/// Summary description for run_specific_query.
/// </summary>
public class run_specific_query : System.Web.UI.Page
{
protected HIV.Controls.NavMenu navMenu;
protected HIV.Controls.NavSubMenu navSubMenu;
protected System.Web.UI.HtmlControls.HtmlGenericControl message;
protected System.Web.UI.WebControls.Label resultsLabel;
protected System.Web.UI.WebControls.DropDownList Specific_Query_DDL;
protected System.Web.UI.WebControls.DropDownList mlno_DDL;
//protected System.Web.UI.WebControls.TextBox date_TB;
protected System.Web.UI.WebControls.CompareValidator dateValidator;
protected System.Web.UI.WebControls.DataGrid resultsDatagrid;
protected System.Web.UI.WebControls.Button submitButton;
protected System.Web.UI.WebControls.Label data_src;
protected System.Web.UI.WebControls.LinkButton exportLinkbutton;private void Page\_Load(object sender, System.EventArgs e) { navMenu.SelectedMainItem = HIV.Controls.NavMenu.MainItems.QUERY; navSubMe
-
[Message Deleted][Message Deleted]
-
Problem in DateTime conversion!! Please helpHow would I do that? Can you please help?
-
Problem in DateTime conversion!! Please helpHello, I am having problem in running query for the following code: Actually My database in in MS Access and I need to compare the date column (which is in Date format in the database) with the value of the Date textbox (which is a string). So maybe I need to convert the string to date format and then compare......should I convert to date format? My date is stored in the database as dd-mmm-yy. For example it's stored as 31-Aug-09. Please assist:
public void executePositiveListQuery_ANY(string selected_Date)
{
string sql;
if(selected_Date=="empty")
sql= "SELECT DISTINCT re_MLNO FROM ml_hiv_status WHERE (re_HIV1_Status=1 AND re_HIV2_Status=1)";
else
{
string selectedDate = (Convert.ToDateTime(selected_Date)).ToShortDateStr ing();// I am having problem here
//DateTime DD= Convert.ToDateTime(selected_Date);
sql= "SELECT re_MLNO FROM ml_hiv_status WHERE ( re_SpecimenDate='" + selectedDate + "' AND re_HIV1_Status=1 AND re_HIV2_Status=1)";
resultsLabel.Text ="You Have selected"+ selectedDate;
}try
{
OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECT ION_STRING);
OleDbDataAdapter adapter = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand(sql, connection);DataSet ds = new DataSet();
adapter.SelectCommand = command;int count = adapter.Fill(ds);
if (count > 0 && count <= 200)
{
DataView view = ds.Tables[0].DefaultView;
//view.Sort=e.SortExpression;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = true;
resultsLabel.Text = count.ToString() + " results found.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = true;
}
else if (count> 200)
{
DataView view = ds.Tables[0].DefaultView;
//view.Sort=e.SortExpression;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = false;
resultsLabel.Text = "More than 200 results found. Please Click the Export to Excel Link to Download the Results.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = true;
}
else
{
resultsLabel.Text = "No results found.";
resultsLabel.Visible = true;
exportLinkbutton.Visible = false;
resultsDatagrid.Visible = false;
}
connection.Close();
}
catch(Exception ex)
{
message.InnerHtml = "SQL: " + sql + "<p></p>" + ex.ToString(); //Now it throws exception here!!
} -
problem is dynamic dropdown list control ...Please help!!!I don't know how to thank you enough! :)all these times I am wondering why this is happening!! But I understood that something is wrong with the post back condition and the way I am calling getMLNO() cause every time I refresh the page or hit submit the MLNO dropdown list was getting refreshed as well and thus selecting ANY every time....
-
problem is dynamic dropdown list control ...Please help!!!Hello, I want submit button to fetch different query results from the database. So I have implemented which query to execute inside the SubmitButton_Click function/method. But it's not working as I have desired....it's fetching one query every time. To give you a brief idea, in my .aspx I have 2 dropdown lists (1 to select which query to run and another one to select which patient number should I pull from the DB), 1 text box which contains date field. I have kinda found what's causing the problem....but don't know how to solve it. Somehow from the drop down list "ANY" is selected all the times.....no matter what I select from the second dropdown list. Any suggestion would be really helpful. The code is as follows:
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;namespace HIV
{
/// <summary>
/// Summary description for run_specific_query.
/// </summary>
public class run_specific_query : System.Web.UI.Page
{
protected HIV.Controls.NavMenu navMenu;
protected HIV.Controls.NavSubMenu navSubMenu;
protected System.Web.UI.HtmlControls.HtmlGenericControl message;
protected System.Web.UI.WebControls.Label resultsLabel;
protected System.Web.UI.WebControls.DropDownList Specific_Query_DDL;
protected System.Web.UI.WebControls.DropDownList mlno_DDL;
protected System.Web.UI.WebControls.TextBox date_TB;
protected System.Web.UI.WebControls.CompareValidator dateValidator;
protected System.Web.UI.WebControls.DataGrid resultsDatagrid;
protected System.Web.UI.WebControls.Button submitButton;
protected System.Web.UI.WebControls.Label data_src;
protected System.Web.UI.WebControls.LinkButton exportLinkbutton;private void Page_Load(object sender, System.EventArgs e)
{
navMenu.SelectedMainItem = HIV.Controls.NavMenu.MainItems.QUERY;
navSubMenu.SelectedMainItem = HIV.Controls.NavMenu.MainItems.QUERY;
navSubMenu.SelectedSubItem = HIV.Controls.NavSubMenu.SubItems.RUN_SPECIFIC_QUER Y;getMLNO();
//if (!this.IsPostBack)
//LoadQueryLinks();
}#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
BuildQueryForm(); [This function/method is calling the submit button function