|
Rank: Member Groups: Member
Joined: 10/13/2009 Posts: 14
|
I need the grid below to be populated w/ a dept#, operation#, hour, empty text box. The grid will be populated w/ hours based on a starting value chosen a dropdown list. I.E. If they choose 06:00, it will populate a grid like 06:00, 07:00, 08:00, etc. so that the user can enter in a qty (an integer value) beside of each time (i.e. during the 06:00 hr, they should get 18 completed). So for all depts chosen in a listbox via a checkbox, it will create "hours" for all operations assigned to that dept. The problem is that the grid seems to be populated w/ empty rows. I can see that the correct grid lines get populated, but nothing is shown (not even the empty textbox). Here is the code. I hope you can help. Thanks in advance.
public class houritem { public string sDeptNum; public string Op; public string Hour; public string Goal; }
List<houritem> hourList = new List<houritem>();
private void ReadTableLoadTargetGrid() //(string theStartingPoint, string theDept) { hourList.Clear();
for (int x = 0; x < Grid2.Items.Count; x++) { Boolean checker = Convert.ToBoolean(Grid2.Items[x].Cells[0].Value); if (checker == true) { sDeptNum = Grid2.Items[x].Cells["Deptnum"].Value.ToString().Trim(); SqlConnection myShopnetConnection = new SqlConnection(sConnectionString); SqlDataReader myReader; myShopnetConnection.Open(); mySelectQuery1 = "SELECT op FROM [ops] where deptnum = '" + sDeptNum + "' order by op"; SqlCommand myCommand1 = new SqlCommand(mySelectQuery1, myShopnetConnection);
myReader = myCommand1.ExecuteReader(); while (myReader.Read()) { for (int i = Convert.ToInt32(this.ddlHoursList.SelectedValue.Trim()); i < 24; i++) { houritem hi = new houritem(); hi.sDeptNum = sDeptNum.ToUpper().Trim(); hi.Op = myReader.GetString(0).ToUpper().Trim(); hi.Hour = string.Format("{0:D2}:00", i); // hi.Goal = ""; hourList.Add(hi); } } myReader.Close(); myReader.Dispose(); myShopnetConnection.Close(); myShopnetConnection.Dispose(); } } //Grid1.RecordCount = 1000; Grid1.DataSource = hourList; Grid1.DataBind(); Grid1.SelectedItemIndex = -1; }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Please try to change your houritem members (sDeptNum, Op, Hour and Goal) to properties. I believe the Grid will only evaluate properties, not member fields. Also make sure you set each column's DataField property to the corresponding property name.
The Grid will never display empty textbox in non-edit mode unless you "render" the textbox yourself. By default the Grid shows the value as static text; For TextBoxColumn it shows a textbox when it enters edit mode.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2009 Posts: 14
|
OK, making them properties worked much better.
Now, how do I manually render the grid? What I mean is that I added an 'EDIT' column to the grid which, when clicked (which then turns to UPDATE CANCEL), allows me to enter text into the textbox and when UPDATE is clicked the value is stored in the box. How do I allow the textboxes to always be enabled. I do not want the user to have to click an EDIT button on every single row that requires a value to be entered into the textbox. FYI...According to the properties of the EO.Web reference, I'm running version 7.0.27.2.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
This is not something you can simply "turn on" on the Grid. By "manually render the textbox", we meant you fill the grid cell with raw HTML that renders as a textbox. For example, instead of setting the Grid's cell value as "abc", you would set it as "<input type='text' value='abc' />". This is not something you will want to do unless you really know what you are getting into. The only thing the Grid does for you in this case is it takes whatever HTML you give to it and faithfully display and it in the cell and does nothing more. That means you will need to handle everything related to editing and saving yourself. It should be technical possible but it probably won't be worth it.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/13/2009 Posts: 14
|
Thanks for the quick response. Do you have another suggestion for a quick method for the user to enter in the desired "Target Goal Quantities"? A grid just seemed to looked nice but the main objective is the ability for the supervisor to just quickly enter in 1 number for each hour of the day w/ as little clicking as necessary.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The easiest way is probably using a repeater to do it the "old fashion" way if you do not have a lot of entries. If you do have a lot of entries, then you probably want to see if there are any other products on the market that can do exactly what you needed because doing it from ground up won't be easy.
Thanks!
|
|