parameters problem in .net 2005
-
hi friends, i am facing a problem in vs 2005 i am using gridview control and sqldatasource bounded to it in the update command of the sqldatasource i am passing a query UPDATE aspnet_UsersInRoles SET RoleId = @RoleId WHERE UserId =@userid the gridview is having three columns userid,username and roleid among which userid is hidden if i make this column visible then the above query is working fine but when i make it visible=false then i am getting an error : Must declare a variable @userid also i want to know if i place a dropdownlist in gridview how to access its selectedvalues as a parameter can anybody help me regards jabbar
jabbarsb
-
hi friends, i am facing a problem in vs 2005 i am using gridview control and sqldatasource bounded to it in the update command of the sqldatasource i am passing a query UPDATE aspnet_UsersInRoles SET RoleId = @RoleId WHERE UserId =@userid the gridview is having three columns userid,username and roleid among which userid is hidden if i make this column visible then the above query is working fine but when i make it visible=false then i am getting an error : Must declare a variable @userid also i want to know if i place a dropdownlist in gridview how to access its selectedvalues as a parameter can anybody help me regards jabbar
jabbarsb
Hi, error : Must declare a variable @userid when column propert visible is false is correct. Since in visual 2005 if column in visible false then data is not binded to that column. Sol: To avoid this problem make visible false of column in RowCreated event of grid. This will solve your problem. hope this helps. Cheers! Anil