2014年7月13日 星期日

[RESOLVED] Make DataCell Content link and open that link in a new window


Hi,


I have already made datagrid cell content link and open that link in a new window, but the problem is that the parent window content disappears and only "[object]" is written on the parent page after click on the link. I want that the Parent page must remains
there and when i click on the link the it opens in a new window as popup.


I have tried the following code


   runat="server"/>


Please correct me if any mistake or tell me some alternate way to do this


Thanks & Regards


Muhammad Arsalan Akhtar



Simply set target="_blank" and use DataNavigateUrlFormatString


    DataNavigateUrlFormatString="LoadBalance.aspx?EmbossLine={0}"
DataTextField="vchrEmbossLine" HeaderText="Emboss Line" Target="_blank" />





your code modify: -



Target="_blank"  runat="server"/>



I have tried this earlier but this will open a new tab, I want to open it as a popup in new window


Thanks for reply ,


plz help me 


Regards 


Muhammad Arsalan Akhtar




Target="_blank"  runat="server"/>


Except hyperlink use anchor tag



adfadfsa


It will work


hyper link only navigate in other tab so best use is that as tag


& you want to use server side you can use make set attribute as
runat="server" id="anchor1"




ars88


if using


'<%#Eval("FieldNameInDataBase")%>'


if link button using



 




Thanks buddy


Tell me one thing that can i use  <%#Eval("FieldNameindatabase")%> in window.open function


Plz reply






Dear,


 


of course you can use like


window.open('<%#Eval("FieldNameindatabase")%>')



SomeOne please help how to bind eval in window.open


Regards 


Muhammad Arsalan Akhtar



Use LinkButton



Set OnClientClick property from RowDataBound Event


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lb = e.Row.FindControl("LinkButton1") as LinkButton;
string vchrEmbossLine=Convert.ToString(DataBinder.Eval(e.Row.DataItem,"vchrEmbossLine"));
lb.OnClientClick = string.Format("window.open('LoadBalance.aspx?EmbossLine={0}',null,'width=800,height=800');", vchrEmbossLine);
}
}









Thanks every one for reply


Regards 


Muhammad Arsalan Akhtar


沒有留言:

張貼留言