Some basic knowledge after Dan pain (2)

Source: Internet
Author: User

Gridview page:

Protected void gvupphoto_pageindexchanging (Object sender, gridviewpageeventargs E)
{
This. gvupphoto. pageindex = E. newpageindex;
This. gvupphoto. databind ();
}
Protected void gvupphoto_pageindexchanged (Object sender, eventargs E)
{
DB. databindgv (gvupphoto, "select * From tb_userupphoto ");
}

Prompt and go to the specified page

Response. Write ("<script language = JavaScript> alert ('only members can upload images !!! '); Location = 'default. aspx'; </SCRIPT> ");

Insert Flash in Asp.net and add it in HTML

<Object classid = "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
Height = "300" style = "width: 472px">
<Param name = "movie" value = "Flash/f702062.swf"/>
<Param name = "wmode" value = "Transparent"> // This statement is transparent.
<Param name = "quality" value = "high">
<Embed Height = "300" pluginspage = "http://www.macromedia.com/go/getflashplayer" Quality = "high"
Src = "Flash/f702062.swf" type = "application/X-Shockwave-flash" width = "400"> </embed>
</Object>

Use... In the gridview to replace ultra-long characters

Sqlconnection con = new sqlconnection ("Data Source = (local); database = database; uid = sa; Pwd = ");
Sqldataadapter da = new sqldataadapter ("select * From tb_bigtitle", con );
Dataset DS = new dataset ();
Da. Fill (DS, "table ");
Gridview1.datasource = Ds;
Gridview1.datakeynames = new string [] {"B _id "};
Gridview1.databind ();
For (INT I = 0; I <gridview1.rows. Count; I ++)
{
String STR;
Datarowview DRV;
If (gridview1.pageindex = 0)
{
DRV = Ds. Tables ["table"]. defaultview [I];
STR = convert. tostring (DRV ["B _content"]);
Gridview1.rows [I]. cells [3]. Text = substring (STR, 5); // call the following method

}< br> else
{< br> DRV = Ds. tables ["table"]. defaultview [5 * (gridview1.pageindex)];
STR = convert. tostring (DRV ["B _content"]);
gridview1.rows [I]. cells [3]. TEXT = substring (STR, 5);

}
Public string substring (string STR, int N)
{
If (Str. Length <n)
{
Return STR;
}
Else
{
String newstr = Str. substring (0, N );
Newstr = newstr + "...";
Return newstr;
}
}

Scroll subtitles

<Marquee direction = "up" scrollamount = "2" scorolldelay = "7" onmouseout = "This. Start ()" onmouseover = "this. Stop ()">
<Span style = "font-size: 14px">
Technical process, superior quality, superior service, public period, and superior
</Span>
</Marquee>

Embedded framework

<IFRAME src = "content. aspx "name =" title "width =" 550 "Height =" 280 "frameborder = 1 scrolling = Yes style =" height: 408px "> </iframe>

Framework (note that the view mode cannot be converted)

<Frameset rows = "113, *" Cols = "*" frameborder = "yes" border = "1" framespacing = "1" noresize>
<Frame src = "Top. aspx" name = "TOP" scrolling = "yes">

<Frameset rows = "*" Cols = "200, *" framespacing = "1" frameborder = "yes" border = "1">
<Frame src = "left. aspx" name = "Left" scrolling = "yes">

<Frame src = "addgdgg. aspx" name = "content" scrolling = "yes">
</Frameset>


</Frameset>

Start the local machine to send emails

<A href = "mailto: chenhongjun125@163.com"> chenhongjun125@163.com </a>

Partial Refresh Technology

<Meta http-equiv = "refresh" content = "2"/>

Stored Procedure query data

Sqlconnection con = new sqlconnection (system. configuration. configurationmanager. etettings ["connectionstring"]);
Con. open ();
Sqldataadapter da = new sqldataadapter ("text", con );
Da. selectcommand. commandtype = commandtype. storedprocedure;
Dataset DS = new dataset ();
Da. Fill (DS );
Gvtext. datasource = Ds;
Gvtext. datakeynames = new string [] {"ID "};
Gvtext. databind ();

Store Data Using Stored Procedures

Sqlconnection con = new sqlconnection (system. configuration. configurationmanager. etettings ["connectionstring"]);
Con. open ();
Try
{
Sqlcommand COM = new sqlcommand ("addtext", con );
Com. commandtype = commandtype. storedprocedure;
Sqlparameter [] prams = {
New sqlparameter ("title", sqldbtype. varchar, 50 ),
New sqlparameter ("content", sqldbtype. varchar, 50 ),
};
Prams [0]. value = tbtitle. text;
Prams [1]. value = tbcontent. text;
Foreach (sqlparameter parameter in prams)
{
Com. Parameters. Add (parameter );
}
Com. executenonquery ();
Con. Close ();
}
Finally
{

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.