글쎄, "This works on my machine"의 경우입니다.ASP.Net LinkButton은 로컬에서는 작동하지만 서버에서는 작동하지 않습니다.
문제는 :
나는에 LinkButton
을 내 GridView
:
dr["L_Website"] = Convert.ToString(reader["L_Website"]);
어쩌면 당신은 또한보고 싶어 : 나는 DataReader
으로 데이터를 입력
<asp:TemplateField HeaderText="Website">
<ItemTemplate>
<asp:LinkButton ID="L_Website" CausesValidation="true" runat="server" Text='<%# Eval("L_Website") %>'
CommandArgument="GoToWebsite" OnClientClick="return confirm('Are you sure you want to go to this Website?');"
CommandName="GoToWebsite"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
GoToWebsitecode :
protected void GV_Contacts_RowCommand(object sender, GridViewCommandEventArgs e)
{
string ID = string.Empty;
string status = string.Empty;
if (e.CommandName == "Edit")
{
//code here
}
else if (e.CommandName == "View")
{
//code here
}
else if (e.CommandName == "GoToWebsite")
{
LinkButton lb = (LinkButton)e.CommandSource;
GridViewRow gvr = (GridViewRow)lb.NamingContainer;
LinkButton LinkButton = gvr.Cells[8].Controls[1] as LinkButton;
if (LinkButton.Text.Substring(0, 3) == "www")
{
System.Diagnostics.Process.Start(LinkButton.Text);
}
else
{
System.Diagnostics.Process.Start("www." + LinkButton.Text);
}
}
}
로컬 컴퓨터에서 정상적으로 작동합니다. 해당 버전이 표시되고이를 클릭하면 로컬 버전이 확인한 다음이 페이지가있는 새 탭이 열립니다. 서버 (IIS 6.0)에서도 올바르게 표시되고, 클릭하면 도 확인되지만, 은 페이지가 아닌 새 탭을 엽니 다.
CausesValidation
을 변경하면 작동하지 않습니다.
OnClientClick
이 없으면 작동하지 않습니다.
LinkButton
위로 (가리 키도록) 이동하면 다시 게시된다는 메시지가 표시됩니다.
이미 감사합니다.
그래, 그 대답은 completly true라고 생각하면 ... 고마워요, 그 방법을 찾으려고 노력할 것입니다. 그러면 JS가 잘하면됩니다. – DatRid
하하 글쎄, 정말 서버 allways에서 iexplorer.exe를 엽니 다 ... 재밌 네요, newb로 내 잘못. :) – DatRid
링크를 작성하고 대상 속성 및 기존 확인 코드를 사용하기 만하면됩니다. – Alexander