Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > พอจะมีแนวทาง ดึงข้อมูลแถวที่ติ๊กใน checkbox จาก gridview มาแสดงใน crystal report ไหมครับ



 

พอจะมีแนวทาง ดึงข้อมูลแถวที่ติ๊กใน checkbox จาก gridview มาแสดงใน crystal report ไหมครับ

 



Topic : 106046

Guest




รบกวนแนะนำทีครับ ยังไปไม่ถูกเลยครับ ตอนนี้ดึงข้อมูลใส่ใน gridview ได้ครับ แต่ไม่รู้จะส่งค่าไปยังไงcode behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack() Then
BindData()
End If
End Sub
Sub BindData()
Dim str As String
str = "SELECT * FROM tb_device"
Dim dt As New DataTable()
dt = connection.QueryDataTable(str)


'*** BindData to GridView ***'
myGridView.DataSource = dt
myGridView.DataBind()

End Sub
Protected Sub myGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)


'*** d_id ***'
Dim lbld_id As Label = CType(e.Row.FindControl("lbld_id"), Label)
If Not IsNothing(lbld_id) Then
lbld_id.Text = e.Row.DataItem("d_id")
End If

'*** d_name ***'
Dim lbld_name As Label = CType(e.Row.FindControl("lbld_name"), Label)
If Not IsNothing(lbld_name) Then
lbld_name.Text = e.Row.DataItem("d_name")
End If

'*** d_serial ***'
Dim lbld_serial As Label = CType(e.Row.FindControl("lbld_serial"), Label)
If Not IsNothing(lbld_serial) Then
lbld_serial.Text = e.Row.DataItem("d_serial")
End If

'*** d_status ***'
Dim lbld_status As Label = CType(e.Row.FindControl("lbld_status"), Label)
If Not IsNothing(lbld_status) Then
lbld_status.Text = e.Row.DataItem("d_status")
End If
End Sub


.aspx
<body>
<form id="form1" runat="server">

<asp:GridView id="myGridView" runat="server" AutoGenerateColumns="False" onRowDataBound="myGridView_RowDataBound">

<Columns>

<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox id="chkd_id" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="d_id">
<ItemTemplate>
<asp:Label id="lbld_id" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="d_name">
<ItemTemplate>
<asp:Label id="lbld_name" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="d_serial">
<ItemTemplate>
<asp:Label id="lbld_serial" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="d_status">
<ItemTemplate>
<asp:Label id="lbld_status" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Submit"></asp:Button>
<hr />
<asp:Label id="lblText" runat="server"></asp:Label>
&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server"></asp:Label>

</form>
</body>




Tag : .NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-02-20 13:25:21 By : Help Me krub View : 1187 Reply : 2
 

 

No. 1

Guest


string usercodes = string.Empty;
foreach (GridViewRow row in gridViewUser.Rows)
{
CheckBox ChkUser = (CheckBox)row.FindControl("chkUser");
if (ChkUser.Checked == true)
{
if (!string.IsNullOrEmpty(usercodes))
usercodes += ",";
Label lbl = (Label)row.FindControl("lblUserCode");
usercodes += Convert.ToString("'" + lbl.Text + "'");
}

}

if (!string.IsNullOrEmpty(usercodes))
{
DataTable dt = respository.SelectApplicationByUser(dropDownListAppName.SelectedValue.ToString(), usercodes, ConnectionString.ConnectionValue);
ReportDocument crReportDocument = PrintReport(dt, dropDownListAppName.SelectedValue.ToString(), usercodes);
System.Web.HttpResponse response = this.Page.Response;
Extenstions.PrintPDF(crReportDocument,Resources.AppToUserRes.pdf_filename,response);
}
else
{
ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", ScriptsBuilder.OpenDialog("#warningDialog", Resources.DialogRes.title_warning, Resources.DialogRes.no_usercodes_selected), true);
}






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-20 13:46:12 By : oami
 


 

No. 2

Guest


ลืมบอกครับว่า พอกดปุ่ม print ให้แสดง crystal report ขึ้นมาเลย ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-20 15:21:52 By : Help me krub
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พอจะมีแนวทาง ดึงข้อมูลแถวที่ติ๊กใน checkbox จาก gridview มาแสดงใน crystal report ไหมครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่