Monday, October 25, 2010
To Open a page in new tab
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "New Window", "javascript:window.open('Thanks.aspx')", true);
make hyperlink open in new tab
just insert target="_blank" in that tag like this:
asp:HyperLink ID="hyp" NavigateUrl="~/aboutus.aspx" runat="server" Text="click" Target="_blank"> asp:HyperLink>
asp:HyperLink ID="hyp" NavigateUrl="~/aboutus.aspx" runat="server" Text="click" Target="_blank"> asp:HyperLink>
Tuesday, October 19, 2010
Selecting Grid Value in RowEditing , RowDeleting,SelectedIndexChanging ് Event
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
string str = GridView1.Rows[e.NewEditIndex].Cells[1].Text;
}
RowDeleting
------------------------------
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string str = GridView1.Rows[e.RowIndex].Cells[1].Text;
}
SelectedIndexChanging Event
----------------------------
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string str = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
}
{
string str = GridView1.Rows[e.NewEditIndex].Cells[1].Text;
}
RowDeleting
------------------------------
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string str = GridView1.Rows[e.RowIndex].Cells[1].Text;
}
SelectedIndexChanging Event
----------------------------
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string str = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
}
To get Grid Selected RowIndex and Template Controls in DropDownList SelectedIndex Event
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = ((DropDownList)sender).Parent.Parent as GridViewRow;
int gvrO = Convert.ToInt32(row.RowIndex);
DropDownList ddltest = new DropDownList();
ddltest = (DropDownList)row.FindControl("ddlTest");
string ss = ddltest.SelectedItem.Text;
}
{
GridViewRow row = ((DropDownList)sender).Parent.Parent as GridViewRow;
int gvrO = Convert.ToInt32(row.RowIndex);
DropDownList ddltest = new DropDownList();
ddltest = (DropDownList)row.FindControl("ddlTest");
string ss = ddltest.SelectedItem.Text;
}
Find Grid Template Controls in Template Combo SelectedIndexChange Event
foreach (GridViewRow gvrow in GridView1.Rows )
{
DropDownList ddltest = new DropDownList();
ddltest = (DropDownList)gvrow.FindControl("ddlTest");
string ss = ddltest.SelectedItem.Text;
}
{
DropDownList ddltest = new DropDownList();
ddltest = (DropDownList)gvrow.FindControl("ddlTest");
string ss = ddltest.SelectedItem.Text;
}
Thursday, October 14, 2010
Preventing browser back button functionality
In page load event ,b4 if(!ispostback) checking
------------------------------------------------
public void AvoidCache()
{
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetValidUntilExpires(false);
}
OR
put this code in B4 the header tag in Default.aspx page.
------------------------------------------------------------
script type = "text/javascript" > //script for preventing browser back button functionality(Akbar)
function preventBack() { window.history.forward(); }
setTimeout("preventBack()", 0);
window.onunload = function() { null };
/script>
------------------------------------------------
public void AvoidCache()
{
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetValidUntilExpires(false);
}
OR
put this code in B4 the header tag in Default.aspx page.
------------------------------------------------------------
script type = "text/javascript" > //script for preventing browser back button functionality(Akbar)
function preventBack() { window.history.forward(); }
setTimeout("preventBack()", 0);
window.onunload = function() { null };
/script>
Subscribe to:
Posts (Atom)