ASP.net判断的问题

baidu_41097100 2017-11-18 11:46:44
如图
当我选择前3行其中一个的时候 走到一个方法, 当我选择其他行的时候,走另一个方法,应该怎么写
...全文
131 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
正怒月神 版主 2017-11-20
楼上已经大体说了。 基本就是行选中事件来判断当前gridview的行下标。然后处理不同的逻辑
  • 打赏
  • 举报
回复
大然然 2017-11-20
protected void GridView1_你的行XXX事件(object sender, EventArgs e) { if(e.RowIndex <= 3) { ...... } else { ...... } }
  • 打赏
  • 举报
回复
baidu_41097100 2017-11-18
后台应该怎么写,不再js中做操作
public static string GetBasicInfoTypes(SqlConnection cn, string VTNAME, string CNAME, string CSNAME, String VendorCode)
        {
            StringBuilder sb = new StringBuilder();
            string SVTNAME = StringHelper.EmptyOrUnescapedStringViaUrlDecode(VTNAME);
            string SCNAME = StringHelper.EmptyOrUnescapedStringViaUrlDecode(CNAME);
            string SCSNAME = StringHelper.EmptyOrUnescapedStringViaUrlDecode(CSNAME);
            sb.Append(@"
SELECT ROW_NUMBER() over(order by X.Score desc) as rows,
X.BasicInfoGUID,X.TB_SQM_Vendor_TypeCID,X.TB_SQM_CommodityCID,X.TB_SQM_Commodity_SubCID,
X.VTNAME,X.CNAME,X.CSNAME,
X.PlantCode,X.VendorCode,X.ISChoose,X.Score,X.Status
 FROM  (

SELECT BasicInfoGUID,
BI.VendorCode as Ven,
B.VendorCode ,
B.PlantCode,
				   TB_SQM_Vendor_TypeCID,
				   TB_SQM_Commodity_SubCID,
				   VT.CNAME AS VTNAME,
				   C.CNAME AS CNAME,
				   CS.TB_SQM_CommodityCID,
				   CS.CNAME AS CSNAME,
				   BI.IsChoose AS ISChoose,
				   Score,
				   ISNULL(AC.Status, 'None') AS Status
			FROM TB_SQM_Manufacturers_BasicInfo BI
				 LEFT OUTER JOIN TB_SQM_Approve_Case AC ON BI.ChooseCaseID = AC.CaseID,
				 TB_SQM_Vendor_Type VT,
				 TB_SQM_Commodity_Sub CS,
				 TB_SQM_Commodity C,
				 TB_SQM_Member_Vendor_Map B
			WHERE BI.TB_SQM_Vendor_TypeCID = VT.CID
			  AND BI.TB_SQM_Commodity_SubTB_SQM_CommodityCID = C.CID
			  AND  BI.TB_SQM_Commodity_SubTB_SQM_CommodityCID = CS.TB_SQM_CommodityCID
				AND BI.TB_SQM_Commodity_SubCID = CS.CID
				AND B.[MemberGUID] = BI.[BasicInfoGUID]
			--and BI.VendorCode = @VendorCode
			) X
			INNER JOIN [dbo].[TB_SQM_Member_Plant] ON [TB_SQM_Member_Plant].[MemberGUID] = X.Ven
			
			");
            if (SVTNAME.Equals(string.Empty) || SCNAME.Equals(string.Empty) || SCSNAME.Equals(string.Empty))
            {
                return "";
            }
            else
            {
                sb.Append("  Where   X.TB_SQM_Vendor_TypeCID = @VTNAME  and X.TB_SQM_CommodityCID = @CNAME ");
                sb.Append(" and X.TB_SQM_Commodity_SubCID = @CSNAME");

            }

            sb.Append(" order by X.Score DESC");
            DataTable dt = new DataTable();
            using (SqlCommand cmd = new SqlCommand(sb.ToString(), cn))
            {
                cmd.Parameters.Add(new SqlParameter("@VTNAME", StringHelper.NullOrEmptyStringIsDBNull(VTNAME)));
                cmd.Parameters.Add(new SqlParameter("@CNAME", StringHelper.NullOrEmptyStringIsDBNull(CNAME)));
                cmd.Parameters.Add(new SqlParameter("@CSNAME", StringHelper.NullOrEmptyStringIsDBNull(CSNAME)));
                cmd.Parameters.Add(new SqlParameter("@VendorCode", VendorCode));
                //cmd.Parameters.Add(new SqlParameter("@VendorCode", VendorCode));
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    dt.Load(dr);
                }
            }


            return JsonConvert.SerializeObject(dt);
        }
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2017-11-18 11:46
社区公告
暂无公告