English 中文(简体)
(ASP.NET) 在电网看来,我如何能够把选定的浏览数据显示在确认方言箱上?
原标题:(ASP.NET) In grid view, how can I make the selected row data show up on a confirmation dialog box?

我在ClientClick上试用了以下代码。 但是,这是一大错误。

return confirm( ""Are you sure you want to report on the  & **row.Cells(3).Text** &  vs  & **row.Cells(4).Text** & game, at the  & **row.Cells(5).Text** &  stadium. For  & **row.Cells(2).Text** &  on the  & **row.Cells(1).Text &** " ." ); 

下面是该法的其余部分。

<asp:gridview id="FixtureGridView" runat="server"
              autogeneratecolumns="False"
              datasourceid="matches"
              height="140px" 
              width="800px" 
              onselectedindexchanged="FixtureGridView_SelectedIndexChanged">
              <columns>
                  <asp:commandfield showselectbutton="True" />
                  <asp:boundfield datafield="date" headertext="date" sortexpression="date" readonly="True" />
                  <asp:boundfield datafield="kick-off time" headertext="kick-off time" sortexpression="kick-off time" />
                  <asp:boundfield datafield="home team" headertext="home team" sortexpression="home team" />
                  <asp:boundfield datafield="away team" headertext="away team" sortexpression="away team" />
                  <asp:boundfield datafield="stadium" headertext="stadium" sortexpression="stadium" />
                  <asp:TemplateField>
                      <ItemTemplate>
                          <asp:LinkButton ID="LinkButton1" Runat="server"
                                          OnClientClick="return confirm( Are you sure you want to report on this game );"
                                          CommandName="Select">
                          Report
                          </asp:LinkButton>
                      </ItemTemplate>
                  </asp:TemplateField>
最佳回答

你们可以使用像这样的电网数据,把发现的控制投向同样的控制类型。

if (e.Row.RowType == DataControlRowType.DataRow) {
    LinkButton link = (LinkButton)e.Row.FindControl("LinkButton1");
    link.Attributes.Add("onclick", "return confirm( Are you sure you want to report on this game );");
}
问题回答

你应当能够利用<代码>建立确认。 Eval功能:

<asp:Button OnClientClick="return confirm( <%# String.Format("Delete {0}?", Eval("SomeColumn")) %> );" />




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签