In the GridView to cover a layer, click ' Open ' to expand this layer, whereas
The JavaScript used is as follows:
< script type = "Text/javascript" >
<! [cdata[
function ShowHidden (Sid,ev)
{
EV = EV | | Window. event;
var target = Ev.target | | Ev.srcelement;
var odiv = document.getElementById ("div" + sid);
ODiv.style.display = ODiv.style.display = = "None"? "Block": "None";
target.innerhtml = ODiv.style.display = = "None"? "Show": "Hidden";
}
]]>
</script >
The code invoked in the GridView is as follows:
< ItemTemplate >
< div style = "font-weight:bold; Background-color: #DEDEDE; ">
< SPAN style = "float:right;
color:red; Cursor:pointer "onclick=" ShowHidden (' <% #Eval ("order_id")%> ', event) ' > Show </span></div>
< div style = "display:none; "id =" div<% #Eval ("order_id")%> ">
< table >
< tr >
< td >
Remark: </td >
< td colspan = "2" >
< Asp:textbox ID = "Txtordertext" runat = "server" Height = "47px" TextMode = "MultiLine" Text = ' <% #Ev Al ("Order_text")%> ' Width = "122px" ></asp:textbox ></td >
</TR >
< tr >
< td >
</td >
< td colspan = "2" >
< Asp:button ID = "btsend" runat = "server" Text = "issue" OnClick = "Button1_Click"/></td >
</TR >
</table >
</div >
</ItemTemplate >
Some people may be a bit confused, I add a button in the GridView, but I double-click the button into the button's onclick event, how do we get the line we clicked the ID (that is, the main building of our database) value.
We often take gridview1.cell[0 in the bound event of Girdview. Text gets the main value of this row, so how can we get the ID value of the line outside the GridView event?
All in all, the GridView is simply the principle of table, so when we know it, we can do it in TableCell.
The following is the code for the button's onclick event
Button Btsend = sender as Button;
TableCell tc = (TableCell) btsend. Parent;
GridViewRow GVR = (gridviewrow) tc. Parent;
EWebShop.BLL.Order Bllorder = new EWebShop.BLL.Order ();
Bllorder.updateordertextandsendtime (GVR. cells[0]. Text, (TextBox) gvr. FindControl ("Txtordertext")). Text, DateTime.Now);
Response.Redirect (Request.Url.ToString ());
I don't need to talk about it here.
If there is anything wrong, please advise.
Note: The above expansion layer of the JS code is used Meng Xianhua teacher's. ^ _ ^
The effect chart is as follows:
Initial diagram:
The point opening effect is as follows