Thursday, December 24, 2009

Infragistics WebCombo Get the Value of Cell by Column Name

Get the Value in a Cell by the Column Name

To get the value in a Infragistics WebCombo cell by the column name (in this case, column DrugName):

string chosenName = e.Row.Cells.FromKey("DrugName").ToString;

where e is the EventArgs from

protected void igWebCombo1_SelectedRowChanged(object sender,
Infragistics.WebUI.WebCombo.SelectedRowChangedEventArgs e)

I had previously gotten the value using an index value:
string chosen = e.Row.Cells[2].Value.ToString().Trim();

but in continuing development, the number of columns may vary, and therefore the index may change.

Monday, November 30, 2009

Query to get the table names in a SqlServer db

The following Query will generate a list of the tables in a sqlserver db

select [name] from sysobjects where [xtype] = 'U' order by [name]

Use [xtype] ='PK' for list of primary keys,

[xtype] = 'P' for list of stored procedures,

etc.

Wednesday, October 21, 2009

Copy Some Rows From Table1 to Table2 SqlServer

I am doing a one-time combining 2 separate legacy database tables that contain some of the same info but also additional different info into one new SqlServer table. I am also copying some but not all of that additional data.

So I am inserting some of the columns from each table into some of the columns in the new table.

If all the columns in table2 are going to be inserted into table1 and the column names are the same I can:

insert into table1 (Detail, Unitname, Sortorder) select * from table2

if there is a change in column name change:

insert into table1 (Detail, Unitname , Sortorder) select facilabbr as Detail, Unitname , Sortnum as Sortorder from table2

Tuesday, October 13, 2009

Javascript Function using RegEx Regular Expression

I need to check client side if a DropDownList.SelectedItem.Value is any of the following: 1,3,9,17,or 15.


Rather than use a clumsy if statement, I do this by seeing if the value will match a Regular Expression:

      function taskChange() {
var task = $get("ddlTest");
var RegExp = "(^1$^3$^9$^17$^15$)" ;
if (RegExp.match(task.value))
{
// A value of 1,3,9,17,or 15 was selected
               // do whatever 
           }
else
{
//Some other value was selected
                // do whatever
}
}

Thursday, September 24, 2009

Playing with an Infragistics WebDialogWindow Bug

Found a bug in the Infragistics WebDialogWindow.

I discovered it when using the zooming function via holding down the Ctrl key and scrolling the mouse wheel to make the display more visible to the group I was demo-ing to. Moving the WebDialogWindow around leaves text behind. Oops.

Not exactly the demo I was shooting for.

But can be used to generate some cool effects:

This is what the WebDialogWindow looks like before moving it:



These are screenshots of the WebDialogWindow on zoom:

Floating away:



Where did my window go?

An out of body experience
:



And my personal favorite -

WebDialogWindow Abstraction :

Thursday, September 17, 2009

Increasing number of connections in IIS 5.1

XP Pro IIS 5.1 is limited by default to 10 concurrent connections.

This can be increased to a maximum of 40 by:

C:\Inetpub\AdminScripts\adsutil set w3svc/MaxConnections 40

Using Manoli

I use http://manoli.net/csharpformat/ , or other manoli flavors, to format code for presentation in this blog.

Delayed action on Mouseover

Haven't tried this yet, just parked it here till I need to use it.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Page title</title>

<script type="text/javascript">
var c=0;
var t;
var myTimer;
function timedCount()
{
document.getElementById('txt').value=c
c=c+1
t=setTimeout("timedCount()",50)
}

function stopCount()
{
clearTimeout(t)
}

</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onmouseover="var myTimer=setTimeout('timedCount()', 1000);" onmouseout="clearTimeout(myTimer);">
<input type="text" id="txt">
<input type="button" value="Stop count!" onClick="stopCount()">
</form>
</body>
</html>

Sunday, June 7, 2009

Gps coordinates from Google maps

To provide directions on my Rahway River Park blog, a have link to google maps.

  1. I open Google Maps to the vicinity of where I would like coordinates.

  2. I use my right click mouse button and select "center map here" from the drop down button.

  3. I click the "go to the address in the location bar" button usually to the right of the address.

  4. A popup appears showing the coordinates of the center of the map like this: (43.60336, -110.7362)


Take a look:
Directions

Gps coordinates from Google maps

To provide directions on my Rahway River Park blog, a have link to google maps.

1. I open Google Maps to the vicinity of where I would like coordinates.
2. I use my right click mouse button and select "center map here" from the drop down button.
4. I click the "go to the address in the location bar" button usually to the right of the address.
5. A popup appears showing the coordinates of the center of the map like this: (43.60336, -110.7362)


blog, I got the l

Directions(Rahway River Park NJ)

Tuesday, May 12, 2009

Easy file upload from client to server using FileUpload

I needed a way to do a file upload from client to server without using FTP and found this easy solution using the FileUpload control.

Duh.

The control appears as a texbox with a Browse... button. The following puts the control on the page and sets the file to be uploaded to directory C:\\rptsys on the server.

<asp:FileUpload ID="FileUpload1" runat="server" filename ="C:\\rptsys\" />

Added a button to initiate the upload and a label to display the result:

<asp:Button ID="Button1" runat="server" Text="UploadFile" onclick="Button1_Click" /> </div> <asp:Label ID="Label1" runat="server" Text="Label"Width="247px"></asp:Label>

I put together a simple UI:


The Browse button opens up a full choose file dialog window.

The backend code:

protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
Label1.Text = "File Uploaded: " + FileUpload1.FileName;
FileUpload1.SaveAs(@"C:\temp\uploads\" +
FileUpload1.FileName);
}
else
{
Label1.Text = "
No File Uploaded.";
}
}

After the file is transmitted, I display a "success" message.

I would have liked to prepopuate the Browse textbox to the directory I know the file is in, but apparently, this cannot be done for security reasons.

Tuesday, May 5, 2009

Microsoft Bug Du Jour

Last Wednesday I was called over by a coworker and informed that my Asp.Net 3.5 app would not run on a 64 Bit PC running Vista.

Where the drop down menu should have been displaying a list of reports, there was a very empty, very white, rectangular box.

Took a look at the View Source to see what was going on. The menu was there and seemed ok.

Then I find out that the machine is running Explorer 8. Click on Compatibility View in the menu and site displays correctly.

Wednesday, April 22, 2009

Corrupted Toolbar in SQL Server Management Studio (SSMS)


I somehow corrupted the toolbar in SQL Server Management Studio (SSMS) the other day:

This is what it looked like
when I selected Edit, and selected File:
       

At first it was annoying. When I thought about it a little longer, I realized, Wow! Think how productive I could be using this toolbar!


But figured I better fix it. I found this site:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=328568

Which had the following info:
I think I found a fix. The fix is:
1) Open Regedit
2) Go to the key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM\Menus
3) Export the key to the Desktop for easy access
4) There are some entries that end in ,1000,1 Try deleting one at a time until the dupe menus disapear
5) Restore the menus.reg export you made after each failed attempt to get the dupes to disappear
6) At some point, they will disapear
Obviously the better fix would be for MS to fix the buggy software or at least explain which key should be deleted.
Posted by Rogue1 on 8/4/2008 at 2:23 PM
Interestingly, I found that this works:
1) Open Regedit
2) Go to the key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM\Menus
3) Export the key to the Desktop for easy access
4) Delete any one entry that ends in ,1000,1
5) Open MS SSMSE and check to make sure the dupes are gone
6) Merge the saved reg file back into the registry
7) Open MS SSMSE and check to make sure the dupes are gone

Interestingly, the dupes appear to have disapeared without really getting rid of any of the entries.
Posted by Rogue1 on 8/4/2008 at 2:33 PM
And here is the key to fix for VS 9 Web Dev Express:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VWDExpress\9.0\Menus
Same process as above.
Posted by Rogue1 on 8/6/2008 at 7:21 PM


So I got into Regedit ( by searching for Regedit in the search field of start -> all programs )

The directions gave the path as:
SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM\Menus

But this was the actual directory name:
SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Shell\Menus

I didn’t have the nerve to delete entries from the registry. After all this was my first time here.

So

- Compared registry listing with listing on my xp. Were the same. Nothing extra on vista.

- Still followed directions to export the listing to desktop ( rc on Menus in directory, choose export ) just in case

- renamed (not deleted) all entries that ending in ,1000,1

- tried to start up ssms ( wouldn’t start)

- changed name of registries back to original

It worked !!!