Dodging the Modal Popup Extender

I wanted the ASP .Net AJAX Toolkit's Modal Popup Extender to appear at some condition, not at the click of a button, that checks that condition.

I accomplished this extender to some dummy button and made that button hide. Whereas called PopupObj.Show() method on the desired condition. But there is still a problem that the popup appear without PostBack only on the click event of the button with whcih it was made. You cannot set TargetControlID of the popupExtender object to any other button on runtime and achieve that functionality.

Instead you can use Update panel for this pupose.

How to Access DataTable from a SqlDataSource Control

First convert source of a SQLDataSource into a DataView,
DataView dv1 =  (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());

then Cast it as DataTable using ToTable() method of DataSet,
DataTable dtSpecTable1 = (DataTable)dv1.ToTable();

Now 'dtSpecTable1' contains your desired DataTable. If u know how to convert such
a dataTable into a named DataTable, please share here in comments.

ASP .Net DataList Strange Errors

I am using ASP .Net's DataLIst control for Data binding in one of my projects. Everything was working fine. In the item command event, I was using value of text from a label which is databound to a primary key (datatype float). But it was rounding off the float value to 13 decimal places when storing as Text of Label. So I could not use it anymore as a primary key for the row which is represented by the current item.

Then I switched to the dataKeys collection of DataList and it was working fine because DataKeys also storss the whole set of primary key values of the current dataset/datatable. But suddenly it started storing DBNull instead of the primary key value in some specific kinds of records, not all of them. I tried it amny times but nothing worked. Naturally I had to switch towards the Text property of Label for those specific Items. 


Related Posts with Thumbnails