I understand what you are saying. Can't see a magic way to handle this. Thank you for the prompt reply. :sigh:
JTRizos
Posts
-
Removing items from a RadioButtonList -
Removing items from a RadioButtonListWe have an application that uses a Radiobuttonlist of 36 items for the user to identify a Reason for a visit. This application has been in use for over 3 years and has created over 40,000 records in a MS-SQL Table. The users of this application would like to recude the number of Reasons in the Radiobuttonlist down to 11. Besides online access, they are able to generate various stat reports using this data. How can I do this and still bring up records that contain Reasons that are no longer on the Radiobuttonlist without generating an SQL exception? I don't think it can easily be done. If I could hide the no longer in use reasons, I could use code behind to show these reasons in a separate field on the screen rather than in the Radiobuttonlist as a selected item. Same thing for the reports. I hope this makes sense. Any advise will be much appreciated. :confused:
-
How can I display a pop-up when hovering over a Gridview row?With help from this forum (Thanx Parwej Ahamad) I got what I needed. I am including the code here in case it can help others. The application has 119 columns and this Popup displays the employee name, job unit and job description by hovering over any row as the user scrolls horizontally. This was based on A Simple DataGrid Row Tooltip For Beginners.[^] .aspx
<!-- Script and Div to set up the Popup with Employee Info -->
<script type="text/javascript">
function ShowTooltip(LName,FName,JUDesc,JTDesc)
{
document.getElementById("td0").innerText=LName;
document.getElementById("td1").innerText=FName;
document.getElementById("td2").innerText=JUDesc;
document.getElementById("td3").innerText=JTDesc;
x=event.clientX + document.documentElement.scrollLeft;
y=event.clientY + document.documentElement.scrollTop + 5;
Popup.style.display="block";
Popup.style.left=x;
Popup.style.top=y;
}function HideToolTip() { Popup.style.display="none"; }
</script>
<div id="Popup" class ="transparent">
<div style="BACKGROUND-COLOR:#003366"><center><b>Employee Info</b></center></div>
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="td0" align="left"></td>
</tr>
<tr>
<td id="td1" align="left"></td>
</tr>
<tr>
<td id="td2" align="left"></td>
</tr>
<tr>
<td id="td3" align="left"></td>
</tr>
</table>
</div>
</div>.aspx.cs
/* Code for Popup with Employee Info */
public void gvRoles_RowDataBound(object sender, GridViewRowEve -
How can I display a pop-up when hovering over a Gridview row?I'll try this again I changed the "" to "<script type="text/javascript">" and I do not get the runtime error anymore for the ShowTooltip(message). So, I changed it back to the original code and no longer get the runtime error. However, I get a webpage message window with a number in it. Pressing OK brings up another webpage message with another number in it. This happens about 3 times. Hovering over a row restarts this series of messages with a different number in each. Any ideas? I know this is abstract but you have been a big help on this. I do not have a messenger here and I know this is cumbersome.</x-turndown>
-
How can I display a pop-up when hovering over a Gridview row?Agreed but I don't have a messenger here. I changed the and the ShowTooltip(message) worked. No runtime error. However, when I put the code back to the way it was I don't get the runtime error but I do get a webpage message with a number in it. When I press the OK button, it goes through a series of three messages having different numbers as I press OK after each one. Hovering over a row starts the series of messages over again. Any idea? I know this is abstract and you probably have better things to do but you have been a big help.</x-turndown>
-
How can I display a pop-up when hovering over a Gridview row?Tried this and got the "JScript runtime error:Object expected" message on each row hovered.
-
How can I display a pop-up when hovering over a Gridview row?It works. I get the alert message each time I hover over a row.
-
How can I display a pop-up when hovering over a Gridview row?I took out everything from the JScript except the document.getElementByID statements and still get the JScript runtime error when I hover over a row. The error occurs on ShowToolTip and HideToolTip. I did notice that I get the "Nothing to report " message from the .aspx.cs code if statement. Not sure why. I am using IE 8 which is standard for the department and am not sure how to test this without VS 2008 or without placing it in the live environment. I've never used TeamViewer and I doubt it would work due to the firewalls used here. The app I am working on will be internal to our department. Sorry I cannot be more helpful.
-
How can I display a pop-up when hovering over a Gridview row?Thanx Parwej, I tried this and the alerts do not pop up. Something does flash on the screen so I am guessing it might be the alerts. The JScript message pops up when I hover over a row and in the source the correct onmouseover and onmouseout are highlighted for the correct row. So I think I am close. I should explain I am testing this using the Debug in Visual Studio 2008. I'll keep trying to get this to work. Thanx for your prompt reply.
-
How can I display a pop-up when hovering over a Gridview row?Thanx to the feedback I've recieved from this forum, I think I am almost there. Viewing the source I can see that the onmouseover and onmouseout controls have been added to each row in the Gridview as intended. However, I get a "Microsoft JScript runtime error: Object expected" error. I cannot figure out why. The code is as follows: .aspx code
<script type="javascript">
function ShowTooltip(LName,FName,JUDesc,JTDesc)
{
document.getElementById("td0").innerText=LName;
document.getElementById("td1").innerText=FName;
document.getElementById("td2").innerText=JUDesc;
document.getElementById("td3").innerText=JTDesc;
x=event.clientX + document.body.scrollLeft;
y=event.clientY + document.body.scrollTop + 10;
Popup.style.display="block";
Popup.style.left=x;
Popup.style.top=y;
}function HideToolTip() { Popup.style.display="none"; }
</script>
<div id="Popup" class ="transparent"> <div style="BACKGROUND-COLOR:#003366"><center><b>Employee Info</b></center></div> <div> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td id="td0" align="left"></td> </tr> <tr> <td id="td1" align="left"></td> </tr> <tr> <td id="td2" align="left"></td> </tr> <tr> <td id="td3" align="left"></td> </tr> </table> </div> </div>
.aspx.cs code
private void InitializeComponent()
{
this.gvRoles.RowDataBound += new GridViewRowEventHandler(this.gvRoles_RowDataBound);
}public void gvRoles_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
e.Row.Attributes.Add("onmouseover", "ShowTooltip('" +
DataBinder.Eval(e.Row.DataItem, "EmployeeNameLast").ToString() + "','" +
DataBinder.Eval(e.Row.DataItem, "EmployeeNameFirst").ToString() + "','" +
DataBinder.Eval(e.Row.DataItem, "JobUnitDescription").ToString() -
How can I display a pop-up when hovering over a Gridview row?Sorry, I hope this link works. Thanx A Simple DataGrid Row Tooltip For Beginners.[^]
-
How can I display a pop-up when hovering over a Gridview row?Thanx Mark. This is kinda new to me and I have only used Gridview in the past. I did find an article with a sample program using Datagrid that does what I want it to do. However, I have not yet gotten it to do what I need. See <a href="http://www.codeproject.com/KB/webforms/Tooltip.aspx?fid=102999&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=1407335"> [] My question is should the code used for a Datagrid work for a Gridview? I have editted my application code with code from this article and get no errors but do not know if this article also applies to a Gridview. :confused: Thanx again for your advise.
-
How can I display a pop-up when hovering over a Gridview row?I have a Gridview application that displays up to 80+ columns showing the various roles a user can have. The first few columns identify the user by name, dept, and job title followed by the various roles each can have, A "Yes" or "No" in a column indicates whether the user has that role. As can be expected, horizontal scrolling means that at some point the columns identifying the user are no longer seen and one gets a grid of Yes and Nos. BTW, the reason this format is desired is so managers and supervisors can compare users and the roles assigned. As a result, sorting by the columns is important. I looked into freezing the left most columns but can't find a solution that will work and still allow sorting by any column. So, I would like to provide a pop-up that displays the user's identity information when one hovers over a row. I have many possibilites but they use Ajax or have a button in a column to click. Is this possible? I reviewed lots of articles on this website plus other websites and have not found what I am looking for. I have tried a few things but they do not do what I would like them to do. So, I thought I would ask. Thanx in advance. :~
-
MSSQL - How can I reference a column to update using a variable??I got it to work. Followed your advise from your previous reply and after a few tries, bingo, it worked. Here's the code in case it can help others. I am leaving the print statements I used for testing.
Declare @colname varchar(200), @Eid varchar(50),@message varchar(80),@command varchar(200)
Declare my_cursor CURSORFor Select replace(replace(replace(SecurityRole,' ',''),'/',''),'-','') as SecRole,EmployeeID
from EmergencyContact.dbo.CSEEmployeeRoles
order by EmployeeID, SecRoleopen my_cursor
fetch next from my_cursor into @colname,@Eid
while @@fetch_status = 0
begin
select @message = @colname+' '+@Eid
--print @messageselect @command= 'update EmergencyContact.dbo.CSERolesRolledUp set '+@colname+' = ''Yes''
where EmployeeID = '+@Eid
exec (@command)
print @UpdDate
--print @colname
--print @command
fetch next from my_cursor into @colname,@Eid
--print @colname
end
close my_cursor
deallocate my_cursorThanx again for your help. Having never used Cursor or Dynamic SQL before, I just needed to know it can be done and I was on the right track. Happy Holidays! :-D
-
MSSQL - How can I reference a column to update using a variable??Thanx for the suggestion. Printing the variable @command displays the correct Update command: update EmergencyContact.dbo.CSERolesRolledUp set AddRequesterInformation = "Yes" where EmployeeID = 38 But I get an "Invalid column name 'Yes'" error and no update is done. Feeling a bit more reassured that this will work but need to figure out why the error. At least you did not say this would not work. Thanx again and Merry Christmas!
-
MSSQL - How can I reference a column to update using a variable??But it does not work and I am stumped. Thanx for your help. I am working through your Pivot article too see if it applies to what I am trying to do. Good article!
-
MSSQL - How can I reference a column to update using a variable??You are right, both their responses were very helpful and I am now working on using a Pivot to do this. Not sure yet how the end result can be used by a GridView to display the data to the user. Just opened your article and seems to be really helpful. Thanx! However, my original question had to do with using a variable to reference a column for updating. From what I've read, this should work ... as I understand it. Sadly, it does not for me. So, final question ... is this doable and if it is, what am I doing wrong? See original question and code. :confused: Thanx again and I will give upvotes to both. :thumbsup:
modified on Tuesday, December 21, 2010 12:11 PM
-
MSSQL - How can I reference a column to update using a variable??Not being able to get the @colname variable to work, here's what I've now been working on. If it works, there will be 100+ case statements. Will what you recommend above work with an Update? My code seems to go through the table being updated once rather than through the CSEEmployeeRoles table which has the multiple records per user. I've done things like this in SQL reports before but never had this problem.
update table1 set
AuditView = case when table2.SecurityRole='Audit View' and AuditView='No' then 'Yes' else AuditView end,
BasicArchive = case when table2.SecurityRole='Basic Archive' then 'Yes' else BasicArchive end,
BasicModify = case when table2.SecurityRole='Basic Modify' then 'Yes' else BasicModify end,
BasicView = case when table2.SecurityRole='Basic View' then 'Yes' else BasicView end,
CentralScanOperations = case when table2.SecurityRole='Central Scan Operations' then 'Yes' else CentralScanOperations end,
CreateorMaintainParticipant = case when table2.SecurityRole='Create or Maintain Participant' then 'Yes' else CreateorMaintainParticipant end,
CreateRefundParticipant = case when table2.SecurityRole='Create Refund Participant' then 'Yes' else CreateRefundParticipant end,from EmergencyContact.dbo.CSEEmployeeRoles as table2 right join EmergencyContact.dbo.CSERolesRolledUp as table1
on (table2.EmployeeID = table1.EmployeeID)Thanx again, Jörgen, for your input.
-
MSSQL - How can I reference a column to update using a variable??Not sure I understand. Also, can I use a PIVOT to create a table available through a GridView or would it be just for reporting? Thanx again!
-
MSSQL - How can I reference a column to update using a variable??I thought about a PIVOT but the users have different security roles so I don't think it is possible to show what roles a user has or does not have so users can be compared. I've created PIVOTS in Excel and can't see how I can inidcate whether a user has or does not have a role and then compare them to other users. I will, however, look into this and see if it will work for this application. Thank you for your response. I appreciate any responces I can get.