Hey Guys, I found an article that helped me nest a datagridview within a datagridview; however, the nested datagridview doesn't scroll. I was wondering if someone could tell me what I'm missing. Here is my code, which works great when the datacolumn is frozen. Dim dt As New DataTable Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sql As String = "SELECT distinct upc,sku,style,class_id,department,vendor FROM items a" Dim adapter As New Odbc.OdbcDataAdapter(sql, New Odbc.OdbcConnection("DSN=tdprod;uid=ccotton;pwd=ccotton")) If Not dt.Columns.Contains("upc") Then dt.Columns.Add("upc") If Not dt.Columns.Contains("sku") Then dt.Columns.Add("sku") If Not dt.Columns.Contains("style") Then dt.Columns.Add("style") If Not dt.Columns.Contains("class_id") Then dt.Columns.Add("class_id") If Not dt.Columns.Contains("department") Then dt.Columns.Add("department") If Not dt.Columns.Contains("vendor") Then dt.Columns.Add("vendor") adapter.Fill(dt) DataGridView1.DataSource = dt DataGridView1.Columns("upc").Frozen = True DataGridView1.Columns("sku").Frozen = True DataGridView1.Columns("style").Frozen = True DataGridView1.ReadOnly = True End Sub Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting If e.RowIndex >= 0 Then If e.ColumnIndex >= 0 Then If e.ColumnIndex = 2 Then Dim list As New DataGridView list.ReadOnly = True Dim helpdt As New DataTable helpdt.Columns.Add("Num") For i As Integer = 0 To 8 Dim sub_row As DataRow = helpdt.NewRow sub_row.Item("Num") = i + 1 helpdt.Rows.Add(sub_row) Next list.DataSource = helpdt DataGridView1.Rows(e.RowIndex).Height = 100 DataGridView1.Columns(e.ColumnIndex).Width = 200 list.Width = 200 list.Height = 100 DataGridView1.Controls.Add(list) D
ccotton333
Posts
-
Nested DataGridView Problem -
Nested RepeaterThank you very much for your information. The problem was that I couldn't access the control from the code behind whic is what I was trying to do. After seeing your example I moved the code to the script portion of the page and it works great. Thanks
-
Nested RepeaterOk I must have really been confusing you. I am able to bind the first 2 repeaters without any problems, but the problem I'm having is that when the second repeater is bound I need a way to access the itembound property of the second repeater. when you nest one repeater inside of another one, you can't access that control directly from the code behind which is why when you bind the first repeater you have to go into the itemBound event of the first repeater and use the command "e.item.findcontrol("nestedrepeater")" to get the nested repeater from the items collection. Now when you do that you then can bind data to that repeater but there is not an ItemBound property for the nested repeater in the codebehind, also all you can access from the codebehind is the main repeater. So, the problem I keep running in to is that since there is no ItemBound event for the second repeater, then I need a way to force the ItemBound event of the Second repeater, so I will be able to access the third repeater in the code behind and bind data to that repeater. So, I need to know of a way to force the ItemBound event of a nested control, so that I can use that event to bind the third repeater. Thanks for all of the help guys.
-
Nested RepeaterThanks for your idea, I have already bound to the first 2 repeaters and it's the third repeater that I can't figure out how to access. I am confused about how you would go about accessing the third repeater since you access the second repeater in the ItemBound event of the first one. I figured there would be some way of performing the same type of thing except this time for the third repeater being accessed on item bound of the second one. but I can't seem to raise the itembound event of the second repeater. If I could figure out a way to access the third repeater in the itembound of the second repeater then I would be able to do everything I want to accomplish. Thanks for all your help.
-
Nested RepeaterThanks for yall's ideas here is the big question I think. I have been able to do everything for the first two repeaters, but I'm having an issue accessing the third repeater. I need to access the third repeater so that I can bind data to that repeater. Once I can access the repeater, I will be able to access the properties of the repeater and do with it what I want to. Does anyone know a way to access a repeater nested within another nested repeater? Sorry I probably could have asked it this simply before. Thanks for any help you guys.
-
Nested RepeaterHey Guys, I am having a hard time with nesting a repeater. Here is what I'm trying to do: I have a Parent Repeater named Repeater1 then inside that repeater I have a nested repeater named ChildRepeater and I'm needing to place another Repeater within the ChildRepeater named SubChildRepeater but here is my question. How would you be able to access the SubChildRepeater in order to bind the corresponding data to that repeater. I'm really not too sure how this would happen I have created one Application that uses the repeater and it hides the child information then on selection of the repeater item it displays the child data and the child data contains a nested repeater that has the subchild information but there is a limitation of one record for the Child data and there can of course be many records in the sub-child data thanks to the repeater. If anyone has any ideas or angles to try doing this i would appreciate it. I have tried just about all of the tricks up my sleeves with no luck, so you're ideas and/or help would be greatly appreciated.
-
Security Risk IssueOk I guess I didn't make myself to clear. My apologies. Ok here it goes. I have a web application that has 30 user controls. What I am wanting to do is if they leave the application in the middle of it and go to some other site like Google. I want to force them to go to the Login page. This would need to be handled when the user goes to another site then tries to return by hitting the Back button. I already had the code you have mentioned but that doesn't solve the problem. Any other ideas would be greatly appreciated. Thanks Chris
-
Security Risk IssueHey guys, Here is the deal I have a web application that needs to be more secure then it already is. What I need to be able to do is if someone navigates to a site outside of the secure application pages then if they hit the back button it needs to not allow them to do anything except redirect them to the login page. I have this functionality when they logout already built in. I am using session variables, and the reason it doesn't redirect is because the session values have not yet timed out. Does anyone know how I could fix this? If so, I would appreciate any help y'all would be willing to give. Thanks, Chris
-
Focus ProblemHey man I had that working on my other versions of the same sub procedure but the reason i was doing the string instead is because I have multiple grids and on page index changed I need to set focus back to the grid that i changed the page index on. but the problem is this, you can't set focus to a datagrid so i have been trying to create a transparent textbox so that it would be there but they wouldn't realixe they could type in it. the idea i have come up with is to make the forecolor, backcolor and cursor when in the textbox transparent there is a problem though for some reason when all this is set up the cursor and text typed in is still black. I have tried making the textbox invisible but it causes an error so if anyone has any ideas of how to make this type of functionality work like I'm talking about an advice would be greatly appreciated.
-
Focus ProblemI am needing some help guys. I have a function that creates a javasript function that will run when the I want it to to set focus on specified objects. I'm using a user control, and the problem is that after the page loads the focus is set to a textbox. that all works fine, but it doesn't set focus where I want it to on PageIndexChanged of one of the 3 grids I have on the usercontrol. The catch is that the first time you do the PageIndexChanged event it doesn't work but the second time you do it it works which I think is kinda weird. Anyways here is the code: Private Function setfocus(ByVal obj As Object) 'this will set focus to a specified object Dim sb As New StringBuilder sb.Append("") sb.Append("function Focus()") sb.Append("{") sb.Append("document.") sb.Append("Form1") sb.Append("['") sb.Append(obj.uniqueid) sb.Append("'].focus();") sb.Append("}") sb.Append("window.onload = Focus;") sb.Append("") Me.Page.RegisterClientScriptBlock("Focus", sb.ToString()) End Function Thanks guys for all your help, Chris Cotton
-
Javascript within UserControlHey guys, I have a web app that uses UserControls. I need to be able to run a javascript function when that UserControl is loaded. The problem I'm having is this when I had the script on a webform, I could run it onBodyLoad, but UserControls don't have body section. So does anyone know how I could call a javascript function on load of the UserControl? Thanks for all your help, Chris Cotton
-
weird Textbox problemHey Guys, I have the strangest error with a function I'm tring to get worked out. ok the problem is this: I have a datagrid that is filtered as you enter into a textbox, and when you find the value you are looking for you can click on it And it should fill the textbox with the value you clicked on and It will also fill a listbox of values. well the listbox values fill perfectly fine the problem is that the textbox value will not change I have tried all the tricks up my sleeves but I have come up fruitless somehow. If anyone could help me with this I would appreciate it. Thanks, Chris Cotton
-
Attributes of a listboxOk guys maybe this will make this idea a little more simple. I'm thinking about making a DIV tag in the HTML code to put in the place of the list box. Has anyone done the functionality that I'm trying to do? It seems simple enough using a DIV tag and Javascript but if anyone has had any experience doing this type of function and could help me figure out if this is a good way of getting this functionality to work, or is there any other alternative for this particular situation? Please let me know. Thanks, ccotton333
-
Attributes of a listboxHey i have a issue i'm trying to work out. OK i hake a listbox(lstResults) and on load of the form I have the following setting done: lstResults.Attributes("onmouseover") = "javascript:onmouseover=alert('" & lblMessage.Text & "')" And what i'm trying to do is instead of it doing a javascript alert on the listbox, I'd like to be able to alert based on the value in the listbox being hovered over. does anyone have any ideas of how to do this? I'm sure there has to be a way to do this, but I have yet to come across anything online that talks about this type of function. any help would be greatlt appreciated. Thanks all, Chris Cotton
-
Allow Drop and ASP .NETSorry I read that wrong. I don't need the mouse coordinates; I need the coordinates of the panel after it has been moved from its default location. Do you have any ideas on how this might can be achieved? Thanks, ccotton333
-
Allow Drop and ASP .NETThanks for the quick reply to my problem. I think you are right that is a very good idea/reason. Thanks for your help, ccotton333
-
Allow Drop and ASP .NETHey guys thanks for the posts. I figured out how to make the panel object moveable by using a javascript. The problem I am having now is that i need to find a way to say the coordinates after the dragging is complete so i can use the coordinates to make the page display like that the next time it is loaded. I'm sure i could use a cookie or something to make it pull the information from so it is displayed properly. Anyone have any idea as to how to get this information and the best way to store it i would appreciate it. Thanks for all you guys' help, ccotton333
-
Allow Drop and ASP .NETHey everyone i was wondering. I know in VB .NET if you set the forms allowdrop property to true then you can drag and drop items onto a windows form in runtime. I was wondering if there was a way to drag and drop a control(like a panel) on a webpage during runtime. I figure there is bound to be a way to do this, but I can't seem to find any documentation on this. I have tried to find a way to make it work, but I have been unsucessful. If anyone knows how to do this or has any ideas on what i need to do to get this to work, If you would please let me know. Thanks for everyone's help, ccotton333
-
Sockets checking if a file existsok basically i have IIS on the webserver and then i have a private network between the SQL server and webserver. the LAN is also on another private lan an and all pcs on that lan can access the internet. so i have this SQL server that cannot reach the internet and i have written two programs one to run on the SQL server and one to run on the webserver that check on the SQL server for the alarm messages. when i am working on the webserver and have established a connection between it and the SQL server(i.e. connect using remote desktop or through the run dialog and enter in the username and password) i can run each program on the machines and they run great but when i set it up to run as a service. it seems to lose the connection between the two servers and doesn't run as it should. any ideas as to what i'm doin wrong? Thanks, ccotton333
-
Sockets checking if a file existsThanks for your response. Well i do have a web server side and a SQL server side and the problem is that the SQL server can't reach the internet and i'm trying to figure out how to send a email out to me to alert me when a certain process occurs and i can map a drive and both sides work or i can try to view the directory of the alarm path and i supply a username and password and it works great. but when i log off the program can't reach the SQL server from the Web Server and i need to be able to access the SQL server. If you could give me any advice on how to go about this i would appreciate it. Thanks ccotton333