Does the query return multiple TechnicalSkills for each employee?
In that case, are you also iterating over the various instances of TechnicalSkills per user?
(you're not as of what you've showed us so far).
Or are you showing only one user at a time?
The query should return a table consisting of rows equal to the amount of technical skills for that user, unless you store all the skill ids in one column with a seperator.
What's this line supposed to check for?
And this if statement compares a Collection of CheckedListBoxItems with a string.
well I actually do need multiple entries /skills in the database yes but I am not sure how to do that part either. I have created a new table and have employeeID and TechnicalSkillsID bu thats as far as I've gotten. I haven't written any code for it. Can you help in that department at all? The skills will be saved to the database by checking checkedlistboxes. I am also using dataadapters. Once I've gotten that part right, will it fix the problem of automatically checking the checkedlist box for a given employees skills?
First of all you should decide whether you want the TechnicalSkillsID as a column in the employees table - as you have now. If you keep it that way, and you want one empolyee to be able to own several TechnicalSkills, you'll have to store several ID's with a separating value.
A better approach, if you ask me, would be to remove the TechnicalSkillsID column from the employee table entirely, and rather create a TechnicalSkills table which uses the employeeID as a keyvalue. Then add one boolean column per technical skill that you want available.
You could then use the column name as a the name of the CheckedListBoxItem and set the Checked property according to the value from the database.
I'll write an example of the latter one:
Create a query for retrieving the row from the TechnicalSkill table with a employeeID equal to the employee you want to configure skills for.
Code for propagating and setting the value for CheckedListBoxItems:
... generate and execute the query for returning the techskills for the given employee
DataTable techSkillsTable = myDataSet.Tables;
//Query should return only one row, but we'll go with a foreachforeach(DataRow row in techSkillsTable.Rows)
foreach (DataColumn column in techSkillsTable.Columns)
string techSkillName = column.ColumnName;
bool userHasSkill = false;
userHasSkill = Convert.ToBoolean(row[column]);
//Do nothing here as userHasSkill is initialized to false.
The problem is that a datalayer doesn't always guarantee that this happens. It really depends on the architecture, but suppose that the datalayer was consumed by web services, then there is no guarantee that this situation would not still occur.
Deja View - the feeling that you've seen this post before.
Ok first a confession I have got a bit Giddy with GDI so like using it for lots of things as it is simple but effective. However last year I made a small image manipulation application in Borland C++. I would like to over the following months build quite a complex one using C#.
Now I know there is a picture box control but I would also like to allow the user to draw things such as simple 2D and 3D shapes etc - my question is this:
Is the picture box control flexible enough for this or would I be better making my own control (say a white background and then drawing on it as the user wishes using GDI) or is there a better built in control?
**Edit - basically what I would like to be able to do is ask any pixel inside a control its colour and also to set its colour
I have a sqlserver database table Students with 4colummns: [studentid], [studentname], [studentaddress], [studenttel].
i want to read all the records from this table, make textboxes and put the data into these textboxes.
Unless you know for a fact that the amount of rows in the table will be of a managable size, you might end up with hundreds of textboxes. (4 textboxes multiplied with the amount of rows).
You can get the amount of rows through the DataSet.Tables[<table index here>].Rows.Count property.
You'd be better off showing the data through either 4 textboxes set to multiline, or even better 4 ListViews, or the best alternative being a DataGridView.
To loop through the rows and retrieve data you could do the following:
... in the method where you process your dataset data ...
DataTable table = yourDataSet.Tables[int tableindex]; //with one table you'd use yourDataSet.Tablesint rowCounter = 0;
foreach(DataRow row in table.Rows)
//Retrieve the data from the various columns in the row through row[int columnindex]//or row["columnname"], or iterate over the columns too and create them generically.//Example of latter oneforeach(DataColumn column in table.Columns)
TextBox textBox = CreateValueTextbox(
column.ColumnName + rowCounter,
rowCounter++; //increase rowcounter by 1
//I'll create a helpermethod for creating the textboxes.private TextBox CreateValueTextbox(string textBoxName, stringvalue)
TextBox textBox = new TextBox();
textBox.Name = textBoxName;
textBox.Text = value;
I haven't compiled this so I might have missed something
Hope some of it can be of help.
Best of luck!
-- modified at 18:19 Thursday 6th September, 2007
Btw - there's no handling of the location of the textboxes, so you'd have to add that yourself.
As of now they'll be placed on top of eachother.
more of an ADO.NET question[^] you can draw the text boxes dynamically (not that hard if you have problems see: here[^] will show how to create buttons then you can change the controls to anything else)
I was create many web controls with LoadControl() and I put these inside panel when Page_Load(),
each control have UpdatePanel for change the content of that control,
but when the event generated by UpdatePanel occurs, the Control dont exists.
Odd question, I know. But I cannot find help with this anywhere. I need, upon right click of a datagrid, to be able to have a context menu pop up (which I know how to do) but within this context menu I want to include the Word Filter, then right next to that have a textbox which one can enter text into for filtering.
If you need an example, Microsoft Access uses this function. I have searched high and low for a solution to this and *any* suggestions or samples would be wonderful.
Last Visit: 31-Dec-99 18:00 Last Update: 24-Sep-23 20:34