Posts

Showing posts from November, 2016

Get all foreign keys reference in sql server

Solved: EXEC sp_fkeys 'TableName' its return to all foreign key reference to make that tables

scroll on top using jquery

Solved: $ ( 'html, body' ). animate ({ scrollTop : '0px' }, 300 ); you can set 0 instead of 300 its quickly go on top and you can change selector where you scroll means if you require scroll top to div just change selector and its working

Set span value using jquery and javascript

Solved: Jquery Example: you can set value two different function. 1- text(); 2- html(); $ ( "#submittername" ). text ( "testing" ); $ ( "#submittername" ). html ( "testing <b>1 2 3</b>" ); Difference between text and html functions text - you can set only value html - you can set value with html code but html tags not necessary for set the value JavaScript Example; you can set value from innerHTML document. getElementById ( "spanID" ).innerHTML. ( "testing" );

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Solved:  When we use conditions on Eval many times we got the error, two ways use solve this error. 1- You make a function what you needs and bind before eval Example: bool ShowAge ( int age ) { return ( age > 18) ; } and call where you use eval Visible=' <% # ShowAge(Eval("Age")) %>' 2- You make a ItemCommand event and define condition on it protected void rptUser_ItemDataBound ( object source, RepeaterCommandEventArgs e ) { TextBox txtAge = ( TextBox )e.Item.FindControl("txtAge"); if ( DataBinder .Eval(e.Item.DataItem, "Age") > 18) { txtAge.Visible = false ; } ; }

how to insert text and tags at the cursor CKEDITOR

//change all "IDofEditor" to the id of your editor; I haven't figured out how to find it less explicitly //insert text CKEDITOR . instances . IDofEditor . insertText ( 'some text here' ); //insert a link (or other tags, modify as needed) //this example uses the selected text for the link text //if removing getSelection() and just inserting it all, you MUST have some link text or it will NOT insert; also if the user selected text first anyway it will change it to "NaN". //the \x22 represents a double quote, thus easy to use within an html onclick //getNative() gets the text, otherwise you get an object CKEDITOR . instances . IDofEditor . insertHtml ( '<a href=\x22my_link\x22>' + CKEDITOR . instances . IDofEditor . getSelection (). getNative () + '</a>' ); //you could also prompt the user for the link text (and title and link or anything else); very fast entry! CKEDITOR . instances . IDofEditor . insertHtml ( ...

float left or right from bootstrap predefined class

if you want to float left or right with Predefined classes of bootstrap Example:  HTML <div class="pull-left"></div> <div class="pull-right"></div> Asp.Net <asp:LinkButton ID="lnkCancel" CssClass="btn btn-primary pull-left" runat="server">Cancel</asp:LinkButton> <asp:LinkButton ID="lnkSave" CssClass="btn btn-primary pull-right" runat="server">Save</asp:LinkButton>

bind dropdownlist in repeater asp.net

Easy you set drop down list datasourse in repeater 1- Create ItemDataBound event 2- Check ListItemType one by one 3- Find dropdown which you take on repeater 4- DataSource protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)         {             try             {                 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)                 {                     DropDownList ddl = (DropDownList)e.Item.FindControl("ddlAbc");                     DataTable dt = GetDataSource();                     ddl.DataSource = lstReferencePoint;                ...