Adding javascript confirmation to row Griview delete
13 October 2009
Get parameters
13 October 2009
<a href=”prodotto.php?cod=a7&cat=2″>
Add a script in a webpage
13 October 2009
//file .cs
Literal1.Text = “<script>AlertOk(“+num+”);</script>”;
//file html
<script language=”javascript”>
function AlertOk(Par1) {
alert(‘Dati caricati ‘+Par1);
}
</script>
Add a new to another web page
13 October 2009
<asp:TemplateField HeaderText=”View”>
<ItemTemplate>
<asp:HyperLink ID=”HyperLink1″ runat=”server” Target=”_blank” NavigateUrl=’<%#”VisualizzaPubblicazione.aspx?ID_PUB=”+ Eval(“ID_PUB”)%>’> View </asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Check the IP address
13 October 2009
Controllo IP
If Left(Request.ServerVariables(“REMOTE_ADDR”),10)<>”192.168.0.” then
Response.Redirect(“http://www.google.it”)
End If
Flush the html content in a excel file
13 October 2009
Response.BufferOutput = False
Response.ContentType = “application/vnd.ms-excel”
Response.AppendHeader(“content-disposition”, “inline; filename=Esporta.xsl”)
*****************istruzioni
Response.Flush()
Response.End()
Absolute path to images
13 October 2009
<%= Request.ApplicationPath %>
<a href=”<%=Request.ApplicationPath%>/info/Page.aspx”>Link to Page</a>
Getting last id
13 October 2009
If you want put last id (a key number) from a table, you can use this code:
String query2=”SELECT @@IDENTITY as IDrestituito”;
OleDbCommand cmd2 = new OleDbCommand(query2, con);
String stringRet=cmd2.ExecuteScalar().ToString();
Int32 ret = Int32.Parse(stringRet);
return ret;
Number of rows in GridView
12 October 2009
<asp:TemplateField HeaderText="N.">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>