I am using "DotNetNuke ASCX Administrative Grids Template Suite" 1.5.0 and created a project, then for selected template instance saved my selections via "Record Template Input".
After this when I tried to open "Record Template Input" again, I've got:
Object reference not set to an instance of an object.Void lboxTables_SelectedIndexChanged(System.Object, System.EventArgs)Call StackSystem.NullReferenceException: Object reference not set to an instance of an object. at MyUI.lboxTables_SelectedIndexChanged(Object sender, EventArgs e) in c:\Program Files\MyGeneration\$ZEUS$DEBUG$ec3a4795-fc77-468e-a2e7-5c706b6d945d.cs:line 1291 at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e) at System.Windows.Forms.ListBox.ClearSelected() at System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value) at MyUI.BindFromProjectData() in c:\Program Files\MyGeneration\$ZEUS$DEBUG$ec3a4795-fc77-468e-a2e7-5c706b6d945d.cs:line 216 at MyUI.MyUI_Load(Object sender, EventArgs e) in c:\Program Files\MyGeneration\$ZEUS$DEBUG$ec3a4795-fc77-468e-a2e7-5c706b6d945d.cs:line 130 at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message...
After a bit of debugging the template I found that
private void lboxTables_SelectedIndexChanged(object sender, System.EventArgs e)
doesn't handle case when this.lboxTables.SelectedItem is null.
I've fixed the code by adding one line(in Bold)
private void lboxTables_SelectedIndexChanged(object sender, System.EventArgs e)
{
MyMeta.ITable newTable = this.lboxTables.SelectedItem as MyMeta.ITable;
if( null == newTable) return;//MNF
if(table == null || table.Name != newTable.Name)
...
and no exceptions are thrown now. But it opened master database instead of database that was saved in template instance.
Further debugging showed, that it is nesessary in connection string to specify Initial Catalog=MyDatabase.
Without Initial Catalog the template instance settings are not restored.
Could you please fix it for the new version of template.
Michael Freidgeim
Blog:
http://geekswithblogs.net/mnf/