Wednesday, October 26, 2005

JavaScript Debugging

Clear the "disable script debugging" checkbox in Internet Explorer's advanced properties. Add the keyword "debugger" somewhere within your JavaScript.When you run the web page from Visual Studio in debugging mode, viola--when it hits the "debugger" statement, the Visual Studio debugger window takes control, you can set your break points, and proceed as normal. You can even get very clever setting the "debugger" from within script created from you server-side code that's registered with one of the many "Register" client-side script block methods.

Tuesday, October 25, 2005

How-To handle RoleManagment features with my own Database

The role-based features in .net 2.0 are using some place to maintain the data. By default this will be the "SQL Server Express" instance which is automatically installed with the Visual Studio. If you dont make this wizard every try will end in the express version :-( - get sad from it but after several researches I have found the solution.

If you would like to use your own DB then go through the follwoing steps:

1 - Create DB
2 - Start -> Programs -> Microsoft Visual Studio 2005 ->
Visual Studio Tools -> Visual Studio 2005 Command
Prompt
3 - write "aspnet_regsql"
4 - Go through the Wizard
5 - Open your Web.Config file and add the following elements:



6 - Run now from your Visual Studio the WebSite / ASP.Net
Configuration [ WebAdmin Tool ]
7 - At the Security you should now choose the Authentication
type, adding your roles and user

thats the whole trick behind it.

Thursday, October 13, 2005

Javascript Control Helpers funcitons

Howto call:
setGroup(!this.checked, 'name1,name2,name3,etc')

radioPropertyChanged(this, 'name1,name2,etc')

getControls();

callOnclick('name');

//////////////////////////////////////
/**
* JavaScript functions for enabling / disabling controls
*/

function radioPropertyChanged(control, controlnamestring) {
if (event.propertyName == '' event.propertyName == 'checked') {
setGroup(control.checked, controlnamestring);
}
}

function setGroup(enabled, controlnamestring) {
// alert(controlnamestring + ': ' + enabled);
var controlnames = controlnamestring.split(',');
for (var i=0; i var control = document.getElementById(controlnames[i]);
if (control) {
if (!enabled && 'isvalid' in control)
ValidatorEnable(control, enabled)
else {
control.enabled = enabled;
control.disabled = !enabled;
}
if (!enabled) {
try {
var tagName=control.tagName.toLowerCase();
if(tagName=='input') {
//alert('Found checked in ' + control.id);
var type=control.type.toLowerCase();
if (type=='text') {
control.value='';
if (control.onchange) control.onchange();
}
else if (type=='radio' type=='checkbox'){
control.checked = false;
if (control.onclick) control.onclick();
if (control.onpropertychange) control.onpropertychange();
}
}
else if (tagName=='select') {
// alert('Found selectedIndex in ' + control.id);
control.selectedIndex = -1;
// control.onchange();
}
}
catch(ex){
//ignore
}
}
}
// else alert('control ' + controlname[i] + ' not found!');
}
}

function getControls(){
var ControlsArr = new Array();
ControlsArr = document.forms[0].getElementsByTagName('input');
for(var i=0; i {
if(ControlsArr[i].type == 'checkbox' ControlsArr[i].type == 'radio'){
//alert(ControlsArr[i].id);
callOnclick(ControlsArr[i].id);
}
}
}

function callOnclick(controlName) {
var control = document.all(controlName);
if (control && control.onclick) control.onclick();
else if (control && control.onchange) control.onchange();
else if (control && control.onpropertychange) control.onpropertychange();
}

Thursday, October 06, 2005

javascript "loop through all the options and test each one until"

You have to loop through all the options and test each one until you find
it, this example assumes you're testing against text value:

function setListbox(name, value, caseSensitive)
{
var oList = document.forms['abc'].elements[name];
var sTestValue = (caseSensitive ? value : value.toLowerCase());
var sListValue;
for (var i = 0; i < oList.options.length; i++)
{
sListValue = (caseSensitive ? oList.options[i].text :
oList.options[i].text.toLowerCase()); //change text to value if you wish to
compare by value of listbox.
if (sListValue == sTestValue)
{
oList.selectedIndex = i;
break;
}
}



}


setListbox("Country", "Canada", true);

untested code provided by joe, dont know how that is, but anyway thanks

Friday, September 30, 2005

.Net C# howto convert DataReader to Dataset

public DataSet ConvertDataReaderToDataSet(OleDbDataReader reader)
{
DataSet dataSet = new DataSet();
DataTable schemaTable = reader.GetSchemaTable();
DataTable dataTable = new DataTable();

for(int cntr = 0; cntr < schemaTable.Rows.Count; ++cntr )
{
DataRow dataRow = schemaTable.Rows[cntr];
string columnName = dataRow["ColumnName"].ToString();
DataColumn column = new DataColumn(columnName,dataRow.GetType());
dataTable.Columns.Add(column);
}

dataSet.Tables.Add(dataTable);

while (reader.Read())
{
DataRow dataRow = dataTable.NewRow();
for(int cntr = 0; cntr < reader.FieldCount; ++cntr)
{
dataRow[cntr] = reader.GetValue(cntr);
}
}

return dataSet;
}

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge