Friday, June 17, 2011

Unable use RegisterStartupScript inside an update panel on "onclick" event

Problem


One Update panel with one gridview in it, and one button on header.

update Panel =update1  
gridview="gridview1" ,
one button in header=btnAdd
 





An javascript alert is needed when user clicks btnAdd_click




Solution : 


ScriptManager.RegisterStartupScript(gridview1gridview1.GetType(), "edit", "alert('xx')", true);

Thursday, June 9, 2011

TRANSACTIONS in SSIS (error: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION


Q: I'm receiving the below error when trying to implement Execute SQL Task.
"The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION." This error also happens on COMMIT as well and there is a preceding Execute SQL Task with BEGIN TRANSACTION tranname WITH MARK 'tran'
I know I can change the transaction option property from "supported" to "required" however I want to mark the transaction. I was copying the way Import/Export Wizard does it however I'm unable to figure out why it works and why mine doesn't work.
Anyone know of the reason?

A:
If you are having three Execute SQL tasks like:
BEGIN TRAN
 |
 |
 |
V

 |
 |
 |
V
END TRAN

Then, you have to set, "RetainSameConnection" property on the connection manager to true. Otherwise, you will get an error message like the one you have reported.

Monday, June 6, 2011

asp Tree view custom node coloring


Hi,
I am attempting to set the background color of a treeview node using the following:
Protected Sub TreeView1_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.PreRender
        For Each node As TreeNode In TreeView1.Nodes
            If node.Text = "Test" Then
                node.ForeColor = System.Drawing.Color.Red
                node.Font.Bold = True
            End If
        Next
End Sub

However, the following error is returned:

 BC30456: 'ForeColor' is not a member of 'System.Web.UI.WebControls.TreeNode'

I have tried searching for an answer, but without success. Any help would be much appreciated.

Thanks.

Edit : The solution will be to set node.Text as a Html , that contains also the color or class that will color the content.