public string udiDataBaseByTransBillNO(string[] UDIString, SqlConnection SqlConn)
{
string strBillNo="";
if (UDIString.Length > 0)
{
isConnected = false;
int intAllupdate = 0;
strError = "";
SqlConnection conn;
SqlTransaction sqlTrans = null;
if (SqlConn == null)
{
conn = DBconn();
}
else
{
conn = SqlConn;
}
try
{
//If database connection is closed, open it.
if (conn.State == ConnectionState.Closed)
{
conn.Open();
isConnected = true;
}
sqlTrans = conn.BeginTransaction();
SqlCommand cmd = new SqlCommand("", conn, sqlTrans);
cmd.CommandType = CommandType.Text;
for (int i = 0; i < UDIString.Length; i++)
{
cmd.CommandText = UDIString[i];
intCount = cmd.ExecuteNonQuery();
intAllupdate = ++intCount;
}
sqlTrans.Commit();
SqlDataAdapter da = new SqlDataAdapter("select name from table where field='condition'", conn);
DataSet ds = new DataSet();
da.Fill(ds);
strBillNo = ds.Tables[0].Rows[0][0].ToString();
}
catch (Exception e)
{
sqlTrans.Rollback();
strError = "Update database failed:" + e.Message;
}
finally
{
if (conn.State != ConnectionState.Closed)
{
conn.Close();
}
}
}
return strBillNo;
}
|
<html>
<head>
<title>Pop-up info panels on anchor tags</title>
<style>
/* Found at http://www.xmpp.org/rfcs/rfc3921.html */
/* Orginal credited as below, with . instead of spaces, now a spammer site */
/* info code from SantaKlauss at http: //www madaboutstyle com/ tooltip2 html */
a.info {
/* This is the key. */
position: relative;
z-index: 24;
text-decoration: none;
}
a.info:hover {
z-index: 25;
color: #FFF; background-color: #900;
}
a.info span { display: none; }
a.info:hover span.info {
/* The span will display just on :hover state. */
display: block;
position: absolute;
font-family: "Courier New", Courier, fixed;
font-weight:bold;
font-size: smaller;
top: 2em; left: 5em; width: 15em;
padding: 2px; border: 1px solid #333;
color: #900; background-color: #EEE;
text-align: left;
}
</style>
</head>
<body>
Demonstration of the use of floating info panels that appear when the mouse floats over an anchor tag.
Here's a couple of examples:
<ul>
<li>
<a href="#" class="info">
<span class="info">One<br />Two<br />Three<br />Four<br /></span>
Here is the anchor text.
</a>
</li>
<li>
<a href="#" class="info">
<span class="info">Red<br />Blue<br />Green<br />Cyan<br /></span>
Here is the anchor text.
</a>
</li>
<li>
<a href="#" class="info">
<span class="info">Fish & Chips<br />Peanut Butter & Jelly<br />Rum & Coke<br />Food & Drink<br /></span>
Here is the anchor text.
</a>
</li>
<li>
<a href="#" class="info">
<span class="info">Part Number One<br />Part Number Two<br />Part Number Three<br />Part Number Four<br /></span>
Here is the anchor text.
</a>
</li>
</ul>
</body>
</html>
|
public class GridViewTemplateDataBind : ITemplate
{
private DataControlRowType templateType;
private string columnName;
public GridViewTemplateDataBind(DataControlRowType type, string colname)
{
templateType = type;
columnName = colname;
}
public void InstantiateIn(System.Web.UI.Control container)
{
switch (templateType)
{
case DataControlRowType.Header:
Literal lc = new Literal();
lc.Text = columnName;
container.Controls.Add(lc);
break;
case DataControlRowType.DataRow:
Label myTextBox = new Label();
myTextBox.DataBinding += new EventHandler(this.TextBoxDataBinding);
RadioButtonList radioList = new RadioButtonList();
radioList.ID = "radioList";
radioList.RepeatDirection = RepeatDirection.Horizontal;
SortedList htable = new SortedList();
htable.Add("1", "1");
htable.Add("2", "2");
htable.Add("3", "3");
htable.Add("4", "4");
htable.Add("5", "5");
radioList.DataSource = htable;
radioList.DataValueField = "Key";
radioList.DataTextField = "Value";
radioList.DataBind();
RequiredFieldValidator rfValid = new RequiredFieldValidator();
rfValid.ControlToValidate = radioList.ID;
rfValid.ErrorMessage = "请点击分数进行投票,非常感谢。Please select one score option, thanks.";
container.Controls.Add(myTextBox);
container.Controls.Add(rfValid);
container.Controls.Add(radioList);
break;
default:
break;
}
}
private void TextBoxDataBinding(Object sender, EventArgs e)
{
Label myTextBox = (Label)sender;
GridViewRow row = (GridViewRow)myTextBox.NamingContainer;
myTextBox.Text = System.Web.UI.DataBinder.Eval(row.DataItem, "allname").ToString();
}
}
|