As follows:
Paste the front-end code first: the key code is to bind the Id through the data (custom attribute) marked by span.
Copy codeThe Code is as follows: <asp: GridView ID = "GvCollect" runat = "server" AutoGenerateColumns = "False"
DataKeyNames = "Id" onrowdeleting = "GvCollect_RowDeleting"
EnableModelValidation = "True">
<Columns>
<Asp: BoundField DataField = "Id" HeaderText = "no."/>
<Asp: TemplateField HeaderText = "title">
<ItemTemplate>
<Span class = "showCon" data = '<% # Eval ("Id") %>'> <% # Eval ("Title") %> </span>
</ItemTemplate>
</Asp: TemplateField>
<Asp: BoundField DataField = "AddTime" HeaderText = "time"/>
<Asp: TemplateField HeaderText = "operation">
<ItemTemplate>
<A href = "Show_Coll.aspx? Id = <% # DataBinder. Eval (Container. DataItem, "Id") %> "target =" _ blank "> View </a>
<Asp: LinkButton ID = "Lbtn" runat = "server" CommandName = "delete" OnClientClick = "return confirm ('Confirm delete')"> delete </asp: LinkButton>
</ItemTemplate>
</Asp: TemplateField>
</Columns>
</Asp: GridView>
& Lt; table width = "100%" & gt;
<Tr>
<Td>
<Asp: Button ID = "BtnAllMove" runat = "server" Text = "all databases" onclick = "BtnAllMove_Click"/>
<Asp: Button ID = "BtnAllDelete" runat = "server" Text = "Clear all records" onclick = "BtnAllDelete_Click"/>
</Td>
<Td>
</Td>
</Tr>
<Tr>
<Td>
</Td>
<Td>
</Td>
</Tr>
</Table>
Then there is the pop-up layer quick code:
<Div id = "divTip" title = "content display" style = "overflow: auto;">
</Div>
Next, let's take a look at the css style reference file and js call (I use the jqueryUI library)Copy codeThe Code is as follows: <link href = "js/jquery-ui-1.8.16.custom.css" rel = "stylesheet" type = "text/css"/>
<Script src = "js/jquery-1.4.1.min.js" type = "text/javascript"> </script>
<Script src = "js/jquery-ui-1.8.16.custom.min.js" type = "text/javascript"> </script>
Copy codeThe Code is as follows: <script type = "text/javascript">
$ (Function (){
// Initialize the pop-up layer, loading is not displayed
$ ("# DivTip"). dialog ({
Show: null,
Width: 500,
Height: 500,
Bgiframe: false,
AutoOpen: false,
Buttons :{
"OK": function (){
$ (This). dialog ("close ");
},
"Cancel": function (){
$ (This). dialog ("close ");
}
}
});
// Cancel event bubbles of the object
$ ("# DivTip"). bind ("click", function (event ){
Event. stopPropagation ();
});
// The dynamic prompt class pop-up layer. When you click an object, the loading page is displayed.
$ (". ShowCon" ).css ("cursor", "pointer"). click (function (event ){
$ ("*"). Stop ();
$ ("# DivTip"). dialog ("close ");
Event. stopPropagation ();
Var top = detail (event.tar get). offset (). top + 20;
Var left = condition (event.tar get). offset (). left;
// Obtain the object source id
Var objId = Response (event.tar get). attr ("data ");
// Alert (objId );
$. Ajax ({
Type: "POST ",
Url: "Show_Coll.aspx ",
Data: "id =" + objId,
Success: function (con ){
$ ("# DivTip" corner. html (con );
}
});
// $ ("# DivTip" pai.html (objId );
$ ("# DivTip"). dialog ("option", "position", [left, top]);
$ ("# DivTip"). dialog ("open ");
});
})
</Script>
Next is the Server Page:
Generally, all the obtained parameters are Request. QueryString [""], but this is to get the parameters in the url, but now it is to get the parameters in the http object, so we use Request [""],
Otherwise, no data can be obtained.Copy codeThe Code is as follows: // Request. QueryString ["id"] = null
If (Request ["id"] = null)
Return 0;
Return Convert. ToInt32 (Request ["id"]. ToString ());