I am trying to show some information to user, using a dynamically created Html "div" Element.
I am even adding jquery function to display that particular element with some cool effects like fadeIn or animate functions,(that too in c#.)
And there are 2 scenarios here,
1. If i add the dynamic div, at the start of the page.controls.Collection, Jquery
function will work,But ViewState of already existing static controls in my aspx page will be lost,(maybe the viewstate order of the controls gets modified when i add the div element at the very beginning of the collection)
2. So in order to retain viewstate of existing controls, i need to add the dynamic controls at the end of the collection, but here in this case, the jquery function will not work!
So, i need to retain both viewstate, n jquery function when i display that dynamic control.Can anyone guide how can i fix this or any alternate solutions also be helpful.
Below is the code..
public static void create_a_floating_div_to_show_comp_details(Page page,Type type,Label totComponents_LBL,Label Components_No_Lbl)
{
HtmlGenericControl ht = new HtmlGenericControl("div");
ht.ID = "genny";
ht.Style.Value ="position:fixed;top:230px;left:-150px;height:auto;width:150px;";
string jqueryFunction_Show = "$('#genny').animate({left:'0px'},500);";
ScriptManager.RegisterStartupScript(page, type, "mykey", "<script type='text/javascript'>" + jqueryFunction_Show + "</script>", false);
page.Controls.AddAt(0, ht);
page.Controls.Add(ht);
}