PDA

View Full Version : معادل این کد تو #C چی میشه ؟



rahele_sa
شنبه 07 بهمن 1385, 14:54 عصر
VB


For intCounter As Byte = 0 To 5
Dim cellSpan As TableCell = CType(e.Row.Cells(intCounter), TableCell)
cellSpan.RowSpan = 2
Next


سی شارپ تابع CType نداره !

Behrouz_Rad
شنبه 07 بهمن 1385, 15:09 عصر
(TableCell) e.Row.Cells(intCounter);

پ.ن: می بینم که حسابی داری با کدهای تاپیک "اعمال متداول با GridView" سر و کله میزنی!

موفق باشید.

rahele_sa
شنبه 07 بهمن 1385, 15:48 عصر
آقای راد خیلی ممنون از اینکه ما رو همراهی می کنید

rahele_sa
شنبه 07 بهمن 1385, 16:02 عصر
چرا این کد تو VB معتبر است


ElseIf (e.Row.RowType = ListItemType.Item) Or (e.Row.RowType = ListItemType.AlternatingItem) Then

حالا من که تبدیلش کردم به #C خطا میده (میگه نمیشه مقایسه کرد اینها رو)


else if (e.Row.RowType == ListItemType.Item || e.Row.RowType == ListItemType.AlternatingItem)

Behrouz_Rad
شنبه 07 بهمن 1385, 16:23 عصر
شما بنویس:


if (e.Row.RowType == DataControlRowType.DataRow )


موفق باشی.

rahele_sa
شنبه 07 بهمن 1385, 17:32 عصر
Protected Sub _Default_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
For Each gvRow As GridViewRow In GridView1.Rows
Dim ref_Chk As CheckBox = CType(gvRow.FindControl("chkRemove"), CheckBox)
ClientScript.RegisterArrayDeclaration("chk_Array_IDs", String.Concat("'", ref_Chk.ClientID, "'"))
Next
End Sub




معادل این یکی چی میشه

Behrouz_Rad
شنبه 07 بهمن 1385, 21:35 عصر
سعی کن کمی خودت زحمت بکشی.

rahele_sa
شنبه 07 بهمن 1385, 22:56 عصر
از صبح تا حالا دارم روی این اعمال متداول روی Grid دارم کار میکنم

فقط تو اینجاش موندم

Behrouz_Rad
شنبه 07 بهمن 1385, 23:19 عصر
foreach (GridViewRow gvRow in GridView1.Rows)
{
CheckBox ref_Chk = ((CheckBox)(gvRow.FindControl("chkRemove")));
ClientScript.RegisterArrayDeclaration("chk_Array_IDs", string.Concat("'", ref_Chk.ClientID, "'"));
}