|
A six-pack for the excellent reply Colin
|
|
|
|
|
I dint mean to offend or embarrass anyone...I`m new to programming , thats y little implulsive.
I really appreciate the help and time people in this forum provide
Sorry once again if any offence meant.
thanks
|
|
|
|
|
We have an ASP with C# application that needs to perform some database work and if that is successful communicate with the clients COM ports and if that is successful commit the transaction and if not rollback.
Right now the applcation is registering a VB script for COM port work but gets no feedback on the success and blindly commits that transaction assuming it worked (not good). This is all pretty new to me, I have been doing C++ only.
Any advice would be appreciated.
Thanks,
Todd
|
|
|
|
|
Hi,
i many of the projects which went on the production server (uses sql server 2000)of other countries there was a common exception in all of them.It is the date conversion exception.Many suggest the way to do it is to
use culture attribute to store date in the sql server .Not shoor about it.Please suggest a way to store the date in the sql server such that
no problem would arise in future projects.
Thnks and regards,
|
|
|
|
|
Hi,
i have a dropdownlist in which on changing the selection i have to give a tooltip above it to display the item selected because the size of the dropwnlist is small to accomodate the entire text .I tried in a dummy page like this.
div id="tooltip" style="LEFT: 488px; WIDTH: 229px; POSITION: absolute; TOP: 130px; HEIGHT: 19px" noWrap>
asp:dropdownlist id="ddl" oonkeyup='showTooltip()' style="Z-INDEX: 101; LEFT: 518px; " runat="server" Width="66px" !-->
But in real scenario in all the pages in which i have dropdownlist i have to incorporate this feature,but i cant change the layout of these pages to accomodate a div .So is there a way to show this tooltip dynamically using javascript (i.e even the div has to be created dynamically just above the ddl)on onkeyup event of the dropdownlist.
pls help me on this ,
thnks in advance
-- modified at 8:20 Friday 23rd June, 2006
|
|
|
|
|
You could insert the div into the DOM dynamically from JavaScript, or possibly have a floating div on the page. I like the implementation www.netflix.com[^] uses when you hover over a movie.
|
|
|
|
|
Hi,
new to DOM .Pls help me out .Is there anyway out other than this.
|
|
|
|
|
Please lookup Document Object Model (DOM) on MSDN, or elsewhere, for a more thorough discussion.
You can access just about any object on the page in the browser window by using JavaScript.
<html><br />
<body onLoad='InsertText()'><br />
<div id='MyDiv'></div><br />
</body><br />
</html><br />
<br />
function InsertText()<br />
{<br />
oDiv = document.getElementById('MyDiv');<br />
oDiv.InnerText = 'Hello, World';<br />
}<br />
Not proper code, but hopefully you get the idea.
|
|
|
|
|
The div tag is not present anywhere in the webform and has to be created on mouseover of the dropdownlist
|
|
|
|
|
insertAdjacentHTML
Again, you can find much more info on this and other DOM related functions and properties by researching. The previous post was meant as an example to show the concept not an actual solution.
|
|
|
|
|
I have a dynamically created table with formatted column headers and row headers and placed a hidden hyperlink (EDIT) within each cell on creation.
Dim bodyCell As TableCell
bodyCell = New TableCell
Dim e_link As LinkButton = New LinkButton
e_link.ForeColor() = System.Drawing.Color.White
e_link.Text = "EDIT"
bodyCell.Controls.Add(e_link)
headerrow.Cells.Add(bodyCell)
I am mimicking an excel sheet and want the user to be able to click in each cell block and if they do select that I want to chagne the color of the background to black to make it selected and vice versa if it is already selected I want to deselect it. I used a hidden hyperlink as it allows the click event - as I find a cross reference between the columns and rows as selected info from the database I color the cell background to black - I just need the syntax to also color my hidden hyperlink but not sure how to write it.:
For k As Integer = 0 To dtoutcomes.Rows.Count - 1
If CInt(dttabledata.Rows(t)("Outcome_id")) = CInt(dtoutcomes.Rows(k)("Outcome_id")) Then
MyTable.Rows(i + 1).Cells(k + 1).BackColor = System.Drawing.Color.Black
MyTable.Rows(i + 1).Cells(k + 1).HorizontalAlign = HorizontalAlign.Center
MyTable.Rows(i + 1).Cells(k + 1).?????
e_link.ForeColor = System.Drawing.Color.Black***** this is my error - but I need to color the hyperlink e_link to the same as the background as the cell background so that it remains hidden
End If
Thanks, Tammy
|
|
|
|
|
Your question is a tad confusing. Are you asking how to get a hold of the cell that the LinkButton was clicked in? Setting the ForeColor of the LinkButton to black is fine if you want the link to not be visible. If you want it to be hidden, why not just set Visible to false? Do you really want a hyperlink in this column and not just a regular button?
Logifusion[^]
|
|
|
|
|
Sorry for the confusion!
The table is created with a white grid set up with all cells white to start with the 'hidden' hyperlink e_link inside each one allowing a user to click on any cell within the grid. The forecolor of each e_link hyperlink is presently white so the user cannot see the test ("EDIT"). To the user it just appears each cell is clickable which is what I want. Then once the table is created the third datatable is looped through to find a match for the row header * column header and changing the background to black to make it appear selected but once it is colored black you can see the white hyperlink text of EDIT all I want to do is also change the e_link.forecolor to black when the cell background changes so it still has the functionality of clicking the cell but the word or hyperlink is not actually visible? It appears as a grid of large table with certain cells colored black and the rest are white. The hyperlinks are required because I want them to be able to 'click' on any cell and once clicked it will change color to the opposite of what it started with to 'select' it - I will then feed the info back into the database.
Thanks, Tammy
|
|
|
|
|
Well, let's start with how you handle the click event. You've added an event handler to the link button and the source parameter of that handler is the actual LinkButton object that was clicked. How do you locate the cell? If you put a CommandArgument on the cell with a value like "5 3" where 5 is the row number and 3 is the column number, then it's easy to locate the cell in the grid. While still inside of your event handler you can set the fore and back colors of the cell and link button.
Logifusion[^]
|
|
|
|
|
I have no event handler - all I want is a hyperlink which I will pass a Request.FilePath based on whether or not the current background color is black or white. Once I pass along this info I will check it based on those values and color it the opposite color.
All I am really looking for is the actual syntax to locate the control as i already know the row & cell I am just not sure how to write the actual line to take the table, row & cell info and then put the control name(e_link) and change the forecolor.
I have this:
MyTable.Rows(i + 1).Cells(k + 1).Controls.Item(0).FindControl(CType(("e_link"), HyperLink))
I just need the proper way to write this line? The control exists already in the cell - I just need to access it and change its forecolor to black. I am new to this so it is probably something very simple.
Thanks, tammy
|
|
|
|
|
I think you're making this more difficult than it has to be. So, I tried doing this myself. I created a web page with a table in it. In the code behind I have this:
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To 10
Dim tr As TableRow = New TableRow
Me.Table1.Rows.Add(tr)
For j As Integer = 0 To 10
Dim tc As TableCell = New TableCell
tr.Cells.Add(tc)
Dim lb As LinkButton = New LinkButton
lb.ForeColor = Color.Blue
lb.Text = "EDIT"
lb.CommandArgument = i.ToString + " " + j.ToString
AddHandler lb.Click, AddressOf lb_Click
tc.Controls.Add(lb)
Next
Next
End Sub
Private Sub lb_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim lb As LinkButton = CType(sender, LinkButton)
Dim s() As String = lb.CommandArgument.Split(" ".ToCharArray)
Dim row As Integer = Integer.Parse(s(0))
Dim col As Integer = Integer.Parse(s(1))
Dim tc As TableCell = Me.Table1.Rows(row).Cells(col)
tc.BackColor = Color.Black
lb.ForeColor = Color.Black
End Sub
I made the forecolor for the linkbutton blue because I couldn't see the table. But, I think you get the idea.
Logifusion[^]
|
|
|
|
|
Hi Dustin (thank you so much for all the help)
Unfortunately there is no linkbutton but it is a hyperlink instead so it will not accept a CommandArgument.
I have this:
**e_link = CType(FindControl(e_link.ID), HyperLink)
e_link.ForeColor = System.Drawing.Color.Black
I am receving this error :
**Object reference not set to an instance of an object
Does this mean it can't find the control in question? I passed the row and column id to string as the ID earlier when I originally set up the table.
e_link.ID = "Row=" & i.ToString & "Column=" & k.ToString
Everything is working great except once I loop through my third datatable to fill in the 'black' selected cells against my data I still have the hyperlink EDIT in white.
The two lines above I think are close to changing it but obviously my syntax is wrong somewhere along the line. . . . . .
Thx, Tammy
|
|
|
|
|
widget1 wrote: e_link = CType(FindControl(e_link.ID), HyperLink)
Has e_link been initialized in this statement? You're asking for e_link.ID . That'll throw a null exception if e_link is not initialized.
Logifusion[^]
|
|
|
|
|
I have these loops above it all:
These loops build my table underneath my customized column headers , showing the whole table with the whole grid with white cells and all white hyperlinks one in each cell.
For i As Integer = 0 To dtassessment.Rows.Count - 1
headerrow = New TableRow
headerrow.ID = i.ToString
headerCell = New TableCell
headerCell.Text = dtassessment.Rows(i)("Name").ToString
headerCell.ApplyStyle(tableStyle)
headerrow.Cells.Add(headerCell)
dtoutcomes = Outcome.GetAll(m_connString)
For k As Integer = 0 To dtoutcomes.Rows.Count - 1
'this line fills in the grid on my table
'it also puts a hyperlink in each cell
Dim bodyCell As TableCell
bodyCell = New TableCell
Dim e_link As HyperLink = New HyperLink
e_link.ForeColor() = System.Drawing.Color.White
e_link.ID = "Row=" & i.ToString & "Column=" & k.ToString
e_link.Text = "EDIT"
e_link.NavigateUrl = "Default.aspx"
bodyCell.Controls.Add(e_link)
headerrow.Cells.Add(bodyCell)
Next
MyTable.Rows.Add(headerrow)
Next
headerrow.ApplyStyle(tableStyle)
I next go through my third datatable looking for matches in column and row values and color the cell accordingly. I also want to color the hyperlink inside this cell to match the background color.
'this section brings in my table data and loops through to find matches and place accordingly
For t As Integer = 0 To dttabledata.Rows.Count - 1
For i As Integer = 0 To dtassessment.Rows.Count - 1
If CInt(dttabledata.Rows(t)("Assessment_id")) = CInt(dtassessment.Rows(i)("Assessment_id")) Then
For k As Integer = 0 To dtoutcomes.Rows.Count - 1
If CInt(dttabledata.Rows(t)("Outcome_id")) = CInt(dtoutcomes.Rows(k)("Outcome_id")) Then
MyTable.Rows(i + 1).Cells(k + 1).BackColor = System.Drawing.Color.Black
MyTable.Rows(i + 1).Cells(k + 1).HorizontalAlign = HorizontalAlign.Center
MyTable.Rows(i + 1).Cells(k + 1).ForeColor = System.Drawing.Color.Black
e_link = CType(FindControl("e_link.ID"), HyperLink)***
e_link.ForeColor = System.Drawing.Color.Black
End If
I think I am having the problem that the e-link.ID created above does not hold the value through to the next set of loops?? Not sure how to overcome this problem. How can I maintain the ID value to my next set off loops?
Thx, t
|
|
|
|
|
widget1 wrote: e_link = CType(FindControl("e_link.ID"), HyperLink)
You declare e_link above inside of two for loops. How does this line even compile?
Logifusion[^]
|
|
|
|
|
I am not sure why but won't vb.net compile and then cause the runtime error versus C# which would not even compile? I declared and initialized above the loops now and now I am getting a runtime error on the next line:
**e_link.ForeColor = System.Drawing.Color.Black
Someone told me a linkbutton causes a postback and there are a lot of them on this table so a hyperlink only causes a page refresh which is better in this case.
How can I hold the ID value from the first set of loops into the second?
This is the first thing I have ever made with asp.net and vb.net for that matter.
Tammy
|
|
|
|
|
widget1 wrote: a linkbutton causes a postback and ... a hyperlink only causes a page refresh
Those things are the same in your case. A typical hyperlink should send you to a new page, but you're detecting that it was clicked and handling it server side, which means the form is being submitted.
widget1 wrote: How can I hold the ID value from the first set of loops into the second?
Where you do this:
e_link.ID = "Row=" & i.ToString & "Column=" & k.ToString
You are creating the ID. Simply copy the code you use to create that ID into the second loop:
e_link = CType(FindControl("Row=" & i.ToString & "Column=" & k.ToString), HyperLink)
Logifusion[^]
|
|
|
|
|
Ok I did that but I am still getting this error:
Object reference not set to an instance of an object.
It is highlighting this line:
Line 151: e_link.ForeColor = System.Drawing.Color.Black
I have no idea what is going on excpet I think it is not recognizing the hyperlink located in that cell.
Tammy
|
|
|
|
|
Well, the way you're doing this is going to be difficult. The page might not recognize the control yet enough to find it for you. So you might try going to the table itself:
e_link = CType(MyTable.Rows(i).Cells(k).Controls(0), HyperLink)
Logifusion[^]
|
|
|
|
|
Honestly, I still think you're making this too difficult. You're chaning the IDs of HyperLink s to overcome the fact they don't have a CommandArgument like LinkButton . Where LinkButton produces the same results and is much easier to use in this case.
Logifusion[^]
|
|
|
|