Archives
-
mailto: from GridView row to allow the user to send emails
If you want to create a HyperLinks in the GridView , so that if the user click on one link the outlock (or email client) will be opened and carry the clicked email ?
-
Hiding some page controls from the Unauthenticated users
If you want to hide controls in the page that is being displayed by the logged in and not logged in users , then you can check the Request.IsAuthenticated property which returns true if the user is logged in ( of course you must be using Windows or Forms authentication). For example, If you want to hide a button from the anonymous users , you can write : Button1.Visible=Request.IsAuthenticated; If you have many controls that you want to hide , you can group them inside a Panel : Panel1.Visible=Request.IsAuthenticated; This will hide the Panel including the controls inside it.
-
The 'SkinId' property can only be set in or before the Page_PreInit event for static controls
If you get that error , then you would probably is trying to set the SkingId programatically.Note that if you are adding your control dynamically, you should assing that proeprty before adding the control to it's parent.I noticed this issue also when the developers trying to set the skinId for the controls that are inside another controls like GridView,Datalist,Repeater,ListView ....
-
How to select an item in Listview based on the DataKey
If you want to Select a listView item based on a Key , you can handle it's ItemDatabound event like below:private int YourKeyValue = 3;
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem di =(ListViewDataItem) e.Item;
int CurrentItemValue = int.Parse(ListView1.DataKeys[di.DataItemIndex].Value.ToString());
if (CurrentItemValue == YourKeyValue)
ListView1.SelectedIndex = di.DataItemIndex;
}
}
-
Resetting scroll position after completion of the partial update
When you use the UpdatePanel to implement partial updates,the scroll position will be maintained between the asynchronous post-backs.However,you may need to reset the scroll position after the partial update completed ( after receiving the response).