<script type="text/javascript">
$(document).ready(function () {
var gv_table_id = '#<%=GridView1.ClientID %>';
var gv_tr = $(gv_table_id).find('tr');
gv_tr.each(function (i) { //Search Column Index = 1 's Value
alert('index:' + i + ' , ' + $(this).find('td').eq(1).text());
})
})
</script>
2013年12月23日 星期一
2013年12月8日 星期日
Button Redirect Page in Iframe
T1.aspx
//HTML
<asp:Button runat="server" ID="btnTask1" OnClick="ShowTask" Text="Task1" CommandArgument="Task1" />
<asp:Button runat="server" ID="btnTask2" OnClick="ShowTask" Text="Task2" CommandArgument="Task2" />
<asp:Button runat="server" ID="btnTask3" OnClick="ShowTask" Text="Task3" CommandArgument="Task3" />
<iframe src="T2.aspx"></iframe>
//C#
public void ShowTask(object sender, EventArgs e)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(),this.GetType().Name,string.Format("window.frames[0].location.href = 'T2.aspx?Task={0}'", ((Button)sender).CommandArgument),true);
}
======================================================================
T2.aspx
//HTML
<asp:Label runat="server" ID="lblTask"></asp:Label>
//C#
protected void Page_Load(object sender, EventArgs e)
{
this.lblTask.Text = this.Request.QueryString.Get("Task");
}
//HTML
<asp:Button runat="server" ID="btnTask1" OnClick="ShowTask" Text="Task1" CommandArgument="Task1" />
<asp:Button runat="server" ID="btnTask2" OnClick="ShowTask" Text="Task2" CommandArgument="Task2" />
<asp:Button runat="server" ID="btnTask3" OnClick="ShowTask" Text="Task3" CommandArgument="Task3" />
<iframe src="T2.aspx"></iframe>
//C#
public void ShowTask(object sender, EventArgs e)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(),this.GetType().Name,string.Format("window.frames[0].location.href = 'T2.aspx?Task={0}'", ((Button)sender).CommandArgument),true);
}
======================================================================
T2.aspx
//HTML
<asp:Label runat="server" ID="lblTask"></asp:Label>
//C#
protected void Page_Load(object sender, EventArgs e)
{
this.lblTask.Text = this.Request.QueryString.Get("Task");
}
Ionic.Zip - Download Zip Multiple Files for Stream
Response.Clear();
Response.BufferOutput = false; // for large files
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=Report.zip");
using (ZipFile zip = new ZipFile())
{
for (int idx = 0; idx <= FileList.Rows.Count - 1; idx++)
{
CheckBox cb = (CheckBox)FileList.Rows[idx].FindControl("RowLevelCheckBox");
if (cb.Checked)
{
zip.AddFile(@url, "");
}
}
zip.Save(Response.OutputStream);
Response.Close();
}
Response.BufferOutput = false; // for large files
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=Report.zip");
using (ZipFile zip = new ZipFile())
{
for (int idx = 0; idx <= FileList.Rows.Count - 1; idx++)
{
CheckBox cb = (CheckBox)FileList.Rows[idx].FindControl("RowLevelCheckBox");
if (cb.Checked)
{
zip.AddFile(@url, "");
}
}
zip.Save(Response.OutputStream);
Response.Close();
}
2013年10月13日 星期日
CSS Maker
Menu
http://cssmenumaker.com/builder/971316
Rdbtn, Ckbox, dplist
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/example/
DatePicker
http://jqueryui.com/datepicker/
button
http://www.cssbutton.me
http://cssmenumaker.com/builder/971316
Rdbtn, Ckbox, dplist
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/example/
DatePicker
http://jqueryui.com/datepicker/
button
http://www.cssbutton.me
2013年10月8日 星期二
Byte Save as Image Files
byte[] FileBS;
FileStream BFile = new FileStream(FileLC, FileMode.Create);
BFile.Write(FileBS, 0, FileBS.GetUpperBound(0) + 1);
BFile.Flush();
BFile.Close();
FileStream BFile = new FileStream(FileLC, FileMode.Create);
BFile.Write(FileBS, 0, FileBS.GetUpperBound(0) + 1);
BFile.Flush();
BFile.Close();
2013年8月14日 星期三
Block during postback
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sScript As String
'頁面執行 Submit 時顯示 blockUI
sScript = "$.blockUI();"
ScriptManager.RegisterOnSubmitStatement(Me, Me.GetType(), "blockUI", sScript)
'頁面載入時隱藏 blockUI
sScript = "$.unblockUI();"
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "unblockUI", sScript, True)
End Sub
Dim sScript As String
'頁面執行 Submit 時顯示 blockUI
sScript = "$.blockUI();"
ScriptManager.RegisterOnSubmitStatement(Me, Me.GetType(), "blockUI", sScript)
'頁面載入時隱藏 blockUI
sScript = "$.unblockUI();"
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "unblockUI", sScript, True)
End Sub
2013年4月25日 星期四
gridview + gridview
html
<asp:GridView ID="FileList" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" EnableViewState="False">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="Label1" runat="server" Text="展開"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="colImageButton1" runat="server" CommandArgument='<%# Eval("ID") %>' ImageUrl="~/img/webmaster/col.gif" OnClick="colImageButton1_Click" Visible='<%# vis(Eval("ID")) %>' CausesValidation="False" />
</ItemTemplate>
<ItemStyle Width="7%" />
<HeaderStyle Font-Size="10pt" CssClass="cell1" />
</asp:TemplateField>
...
...
...
</Columns>
</asp:GridView>
code
Protected Sub FileList_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles FileList.RowDataBound
If Not (ViewState("cID") Is Nothing) Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim drv As DataRowView = e.Row.DataItem
Dim OrderID As String = CStr(ViewState("cID"))
'判斷訂單編號相同的Row才要處理
If CStr(drv.Item("ID")) = OrderID Then
'產生新的GridViewRow
Dim gvRow As New GridViewRow(0, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
'建立一個Cell
Dim lab1 As New Label
lab1.Text = "xxx"
tCell.Controls.Add(lab1)
'設定合併Cell
tCell.Attributes.Add("colspan", "6")
'Cell放入GridViewRow
gvRow.Cells.Add(tCell)
'GridViewRow放到GridView中
e.Row.Parent.Controls.AddAt(e.Row.RowIndex + 2, gvRow)
End If
End If
End If
End Sub
2013年4月3日 星期三
TextBox 提示輸入標記
<asp:TextBox ID="txtName" runat="server" Text="write here" OnFocus="javascript:if(this.value=='write here') {this.value=''}" OnBlur="javascript:if(this.value==''){this.value='write here'}" />
2013年3月28日 星期四
MySQL Select
Dim con1 As New MySqlConnection("server=localhost;Port=3307;user id=root;password=****;database=benchmark_database")
Dim sda1 As New MySqlDataAdapter("select * from class", con1)
Dim ds1 As New DataSet()
sda1.Fill(ds1)
My.Response.Write(ds1.Tables(0).Rows(0).Item(0))
2013年3月20日 星期三
MySQL ConnectionString
<add name="ConnectionString" connectionString="User Id=root;Password=****;Host=255.255.255.255;Port=3307;Database=benchmark_database;Persist Security Info=True;CharSet=utf8;" providerName="Devart.Data.MySql" />
ref http://www.connectionstrings.com/mysql
2013年1月9日 星期三
Web Form 事件
protected void Page_PreInit(object sender, EventArgs e){
}
protected void Page_Init(object sender, EventArgs e){
}
protected void Page_InitComplete(object sender, EventArgs e){
}
protected void Page_PreLoad(object sender, EventArgs e){
}
protected void Page_Load(object sender, EventArgs e){
}
protected void Page_LoadComplete(object sender, EventArgs e){
}
protected void Page_PreRender(object sender, EventArgs e){
}
protected void Page_PreRenderComplete(object sender, EventArgs e){
}
protected void Page_SaveStateComplete(object sender, EventArgs e){
}
訂閱:
文章 (Atom)