Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Help


Message #1 by "Christine Anwar" <christine.anwar@i...> on Wed, 6 Dec 2000 07:26:46 -0800
Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks

Message #2 by Susan Warren <swarren@m...> on Wed, 6 Dec 2000 07:28:24 -0800
This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks

Message #3 by "Christine Anwar" <christine.anwar@i...> on Wed, 6 Dec 2000 07:53:33 -0800
Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks



Message #4 by Susan Warren <swarren@m...> on Wed, 6 Dec 2000 09:32:43 -0800
My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks












begin 600 listInGrid.aspx

M/"5`($EM<&]R="!.86UE<W!A8V4](E-Y<W1E;2Y$871A(B`E/@T*/"5`($EM

M<&]R="!.86UE<W!A8V4](E-Y<W1E;2Y$871A+E-13"(@)3X-"@T*/&AT;6P^

M#0H-"CQS8W)I<'0@;&%N9W5A9V4](D,C(B!R=6YA=#TB<V5R=F5R(CX-"@T*

M("`@(%-13$-O;FYE8W1I;VX@;7E#;VYN96-T:6]N.PT*("`@('!U8FQI8R!!

M<G)A>4QI<W0@4...=&5);F1E>#L-"@T*("`@('!R;W1E8W1E9"!V;VED(%!A

M9V5?3&]A9"A/8FIE8W0@4...)C+"!%=F5N=$%R9W,@12D-"B`@("![#0H@("`@

M("`@(&UY0V]N;F5C=&EO;B`](&YE=R!344Q#;VYN96-T:6]N*")S97)V97(]

M;&]C86QH;W-T.W5I9#US83MP=V0].V1A=&%B87-E/7!U8G,B*3L-"@T*("`@

M("`@("!I9B`H(4ES4&]S=$)A8VLI#0H@("`@("`@("`@("!":6YD1W)I9"@I

M.PT*#0H@("`@("`@(%-T871E26YD97@@/2!N97<@07)R87E,:7-T*"D[#0H@

M("`@("`@(%-13$1A=&%296%D97(@9'([#0H-"B`@("`@("`@+R]P;W!U;&%T

M92!A<G)A>6QI<W0@9...)O;2!D871A8F%S90T*("`@("`@("!344Q#;VUM86YD

M(&UY0V]M;6%N9"`](&YE=R!344Q#;VUM86YD*")S96QE8W0@9...&ES=&EN8W0@

M4W1A=&4@9...)O;2!!=71H;W)S(BP@;7E#;VYN96-T:6]N*3L-"B`@("`@("`@

M;7E#;VYN96-T:6]N+D]P96XH*3L-"B`@("`@("`@;7E#;VUM86YD+D5X96-U

M=&4H;W5T(&1R*3L-"@T*("`@("`@("!W:&EL92`H9'(N4F5A9"@I*0T*("`@

M("`@("![#0H@("`@("`@("`@("!3=&%T94EN9&5X+D%D9"`H9');(E-T871E

M(ETI.PT*("`@("`@("!]#0H-"B`@("`@("`@;7E#;VYN96-T:6]N+D-L;W-E

M*"D[#0H@("`@?0T*#0H@("`@<'5B;&EC(&EN="!'9713=&%T94EN9&5X*%-T

M<FEN9R!S=&%T94YA;64I#0H@("`@>PT*("`@("`@("!I9B`H4W1A=&5);F1E

M>"Y);F1E>$]F*'-T871E3F%M92D@(3T@+3$I#0H@("`@("`@("`@("!R971U

M<FX@4...=&5);F1E>"Y);F1E>$]F*'-T871E3F%M92D[#0H@("`@("`@(&5L

M<V4-"B`@("`@("`@("`@(')E='5R;B`P.PT*("`@('T-"@T*("`@('!U8FQI

M8R!V;VED($UY1&%T84=R:61?161I="A/8FIE8W0@<V5N9&5R+"!$871A1W)I

M9$-O;6UA;F1%=F5N=$%R9W,@12D-"B`@("![#0H@("`@("`@($UY1&%T84=R

M:60N161I=$ET96U);F1E>"`]("AI;G0I12Y)=&5M+DET96U);F1E>#L-"B`@

M("`@("`@0FEN9$=R:60H*3L-"B`@("!]#0H-"B`@("!P=6)L:6,@=F]I9"!-

M>41A=&%'<FED7T-A;F-E;"A/8FIE8W0@<V5N9&5R+"!$871A1W)I9$-O;6UA

M;F1%=F5N=$%R9W,@12D-"B`@("![#0H@("`@("`@($UY1&%T84=R:60N161I

M=$ET96U);F1E>"`]("TQ.PT*("`@("`@("!":6YD1W)I9"@I.PT*("`@('T-

M"@T*("`@('!U8FQI8R!V;VED($UY1&%T84=R:61?57!D871E*$]B:F5C="!S

M96YD97(L($1A=&%'<FED0V]M;6%N9$5V96YT07)G<R!%*0T*("`@('L-"B`@

M("`@("`@4W1R:6YG('5P9&%T94-M9"`](")54$1!5$4@0...:&]R<R!3150@

M875?:60@/2!`260L(&%U7VQN86UE(#T@0...$Q.86UE+"!A=5]F;F%M92`]($!&

M3F%M92P@<&AO;F4@/2!`4&AO;F4L("(-"B`@("`@("`@("`@("`K(")A9&1R

M97-S(#T@0...$%D9')E<W,L(&-I='D@/2!`0VET>2P@<W1A=&4@/2!`4W1A=&4L

M('II<"`]($!::7`L(&-O;G1R86-T(#T@0...$-O;G1R86-T('=H97)E(&%U7VED

M(#T@0...$ED(CL-"@T*("`@("`@("!344Q#;VUM86YD(&UY0V]M;6%N9"`](&YE

M=R!344Q#;VUM86YD*'5P9&%T94-M9"P@;7E#;VYN96-T:6]N*3L-"@T*("`@

M("`@("!M>4-O;6UA;F0N4&%R86UE=&5R<RY!9&0H;F5W(%-13%!A<F%M971E

M<B@B...$ED(BP@4...%,1&%T851Y<&4N5F%R0VAA<BP@,3$I*3L-"B`@("`@("`@

M;7E#;VUM86YD+E!A<F%M971E<G,N061D*&YE=R!344Q087)A;65T97(H(D!,

M3F%M92(L(%-13$1A=&%4>7!E+E9A<D-H87(L(#0P*2D[#0H@("`@("`@(&UY

M0V]M;6%N9"Y087)A;65T97)S+D%D9"AN97<@4U%,4&%R86UE=&5R*")`1DYA

M;64B+"!344Q$871A5'EP92Y687)#:&%R+"`R,"DI.PT*("`@("`@("!M>4-O

M;6UA;F0N4&%R86UE=&5R<RY!9&0H;F5W(%-13%!A<F%M971E<B@B...%!H;VYE

M(BP@4...%,1&%T851Y<&4N0VAA<BP@,3(I*3L-"B`@("`@("`@;7E#;VUM86YD

M+E!A<F%M971E<G,N061D*&YE=R!344Q087)A;65T97(H(D!!9&1R97-S(BP@

M4U%,1&%T851Y<&4N5F%R0VAA<BP@-...#`I*3L-"B`@("`@("`@;7E#;VUM86YD

M+E!A<F%M971E<G,N061D*&YE=R!344Q087)A;65T97(H(D!#:71Y(BP@4...%,

M1&%T851Y<&4N5F%R0VAA<BP@,C`I*3L-"B`@("`@("`@;7E#;VUM86YD+E!A

M<F%M971E<G,N061D*&YE=R!344Q087)A;65T97(H(D!3=&%T92(L(%-13$1A

M=&%4>7!E+D-H87(L(#(I*3L-"B`@("`@("`@;7E#;VUM86YD+E!A<F%M971E

M<G,N061D*&YE=R!344Q087)A;65T97(H(D!::7`B+"!344Q$871A5'EP92Y#

M:&%R+"`U*2D[#0H@("`@("`@(&UY0V]M;6%N9"Y087)A;65T97)S+D%D9"AN

M97<@4U%,4&%R86UE=&5R*")`0V]N=')A8W0B+"!344Q$871A5'EP92Y687)#

M:&%R+#$I*3L-"@T*("`@("`@("!M>4-O;6UA;F0N4&%R86UE=&5R<ULB0$ED

M(ETN5F%L=64@/2!->41A=&%'<FED+D1A=&%+97ES6RAI;G0I12Y)=&5M+DET

M96U);F1E>%T[#0H-"B`@("`@("`@4W1R:6YG6UT@8...]L<R`]('LB3$YA;64B

M+")&3F%M92(L(E!H;VYE(BPB061D<F5S<R(L(D-I='DB+")::7`B?3L-"@T*

M("`@("`@("!F;W(@*&EN="!I/3`[(&D\-CL@:2LK*0T*("`@("`@("![#0H@

M("`@("`@("`@("!3=')I;F<@8V]L=F%L=64@/2`H*%1E>'1";W@I...)=&5M

M+D9I;F1#;VYT<F]L*")E9&ET7R(@*R!C;VQS6VE=*2DN5&5X=#L-"@T*("`@

M("`@("`@("`@+R\@8...@9F]R(&YU;&P@=F%L=65S(&EN(')E<75I<F5D

M(&9I96QD<PT*("`@("`@("`@("`@:68@*&D\,R`F)B!C;VQV86QU92`]/2`B

M(BD-"B`@("`@("`@("`@('L-"B`@("`@("`@("`@("`@("!-97-S86=E+DEN

M;F5R2'1M;"`](")%4E)/4CH@3...;"!V86QU97,@;F]T(&%L;&]W960@9...]R

M($YA;64@;W(@4&AO;F4B.PT*("`@("`@("`@("`@("`@($UE<W-A9V4N4W1Y

M;&5;(F-O;&]R(ET@/2`B<F5D(CL-"B`@("`@("`@("`@("`@("!R971U<FX[

M#0H@("`@("`@("`@("!]#0H-"B`@("`@("`@("`@(&UY0V]M;6%N9"Y087)A

M;65T97)S6R)`(B`K(&-O;'-;:5U=+E9A;'5E(#T@8...]L=F%L=64[#0H@("`@

M("`@('T-"@T*("`@("`@("!M>4-O;6UA;F0N4&%R86UE=&5R<ULB0%-T871E

M(ETN5F%L=64@/2`H*$1R;W!$;W=N3&ES="E%+DET96TN1FEN9$-O;G1R;VPH

M(F5D:71?4W1A=&4B*2DN4V5L96-T961)=&5M+E1O4W1R:6YG*"D[#0H-"B`@

M("`@("`@:68@*"@H0VAE8VM";W@I...)=&5M+D9I;F1#;VYT<F]L*")E9&ET

M7T-O;G1R86-T(BDI+D-H96-K960@/3T@=')U92D-"B`@("`@("`@("`@(&UY

M0V]M;6%N9"Y087)A;65T97)S6R)`0V]N=')A8W0B72Y686QU92`]("(Q(CL-

M"B`@("`@("`@96QS90T*("`@("`@("`@("`@;7E#;VUM86YD+E!A<F%M971E

M<G-;(D!#;VYT<F%C=")=+E9A;'5E(#T@(C`B.PT*#0H@("`@("`@(&UY0V]M

M;6%N9"Y!8W1I=F5#;VYN96-T:6]N+D]P96XH*3L-"@T*("`@("`@("!T<GD-

M"B`@("`@("`@>PT*("`@("`@("`@("`@;7E#;VUM86YD+D5X96-U=&5.;VY1

M=65R>2@I...*("`@("`@("`@("`@365S<V%G92Y);FYE<DAT;6P@/2`B/&(^

M4F5C;W)D(%5P9&%T960\+V(^/&)R/B(@*R!U<&1A=&5#;60[#0H@("`@("`@

M("`@("!->41A=&%'<FED+D5D:71)=&5M26YD97@@/2`M,3L-"B`@("`@("`@

M?0T*("`@("`@("!C871C:"`H4U%,17AC97!T:6]N(&4I#0H@("`@("`@('L-

M"B`@("`@("`@("`@(&EF("AE+DYU;6)E<B`]/2`R-C(W*0T*("`@("`@("`@

M("`@("`@($UE<W-A9V4N26YN97)(=&UL(#T@(D524D]2.B!!(')E8V]R9"!A

M;')E861Y(&5X:7-T<R!W:71H('1H92!S86UE('!R:6UA<GD@:V5Y(CL-"B`@

M("`@("`@("`@(&5L<V4-"B`@("`@("`@("`@("`@("!-97-S86=E+DEN;F5R

M2'1M;"`](")%4E)/4CH@0...]U;&0@;F]T('5P9&%T92!R96-O<F0L('!L96%S

M92!E;G-U<F4@=&AE(&9I96QD<R!A<F4@8...]R<F5C=&QY(&9I;&QE9"!O=70B

M.PT*("`@("`@("`@("`@365S<V%G92Y3='EL95LB8V]L;W(B72`](")R960B

M.PT*#0H@("`@("`@('T-"@T*("`@("`@("!M>4-O;6UA;F0N06-T:79E0V]N

M;F5C=&EO;BY#;&]S92@I...*#0H@("`@("`@($)I;F1'<FED*"D[#0H@("`@

M?0T*#0H@("`@<'5B;&EC('9O:60@0...$=R:60H*0T*("`@('L-"B`@("`@

M("`@4U%,1&%T85-E=$-O;6UA;F0@;7E#;VUM86YD(#T@;F5W(%-13$1A=&%3

M971#;VUM86YD*")S96QE8W0@*B!F<F]M($%U=&AO<G,B+"!M>4-O;FYE8W1I

M;VXI.PT*#0H@("`@("`@($1A=&%3970@9...',@/2!N97<@1&%T85-E="@I.PT*

M("`@("`@("!M>4-O;6UA;F0N1FEL;$1A=&%3970H9',L(")!=71H;W)S(BD[

M#0H-"B`@("`@("`@37E$871A1W)I9"Y$871A4V]U<F-E/61S+E1A8FQE<ULB

M075T:&]R<R)=+D1E9F%U;'16:65W.PT*("`@("`@("!->41A=&%'<FED+D1A

M=&%":6YD*"D[#0H@("`@?0T*#0H\+W-C<FEP=#X-"@T*/&)O9'D@<W1Y;&4]

M(F9O;G0Z(#$P<'0@=F5R9&%N82(^#0H-"B`@/&9O<FT@<G5N870](G-E<G9E

M<B(^#0H-"B`@("`\:#,^/&9O;G0@9...%C93TB5F5R9&%N82(^57!D871I;F<@

M82!2;W<@;V8@1...&%T82!W+R!496UP;&%T960@0...]L=6UN/"]F;VYT/CPO:#,^

M#0H-"B`@("`\<W!A;B!I9#TB365S<V%G92(@36%I;G1A:6Y3=&%T93TB9F%L

M<V4B('-T>6QE/2)F;VYT.B!A<FEA;"`Q,7!T.R(@<G5N870](G-E<G9E<B(O

M/CQP/@T*#0H@("`@/$%34#I$871A1W)I9"!I9#TB37E$871A1W)I9"(@<G5N

M870](G-E<G9E<B(-"B`@("`@(%=I9'1H/2(X,#`B#0H@("`@("!"86-K0V]L

M;W(](B-C8V-C9F8B#0H@("`@("!";W)D97)#;VQO<CTB8FQA8VLB#0H@("`@

M("!3:&]W1F]O=&5R/2)F86QS92(-"B`@("`@($-E;&Q0861D:6YG/3,-"B`@

M("`@($-E;&Q3<&%C:6YG/2(P(@T*("`@("`@1F]N="U.86UE/2)697)D86YA

M(@T*("`@("`@1F]N="U3:7IE/2(X<'0B#0H@("`@("!(96%D97)3='EL92U"

M86-K0V]L;W(](B-A86%A9&0B#0H@("`@("!/;D5D:71#;VUM86YD/2)->41A

M=&%'<FED7T5D:70B#0H@("`@("!/;D-A;F-E;$-O;6UA;F0](DUY1&%T84=R

M:61?0V%N8V5L(@T*("`@("`@3VY5<&1A=&5#;VUM86YD/2)->41A=&%'<FED

M7U5P9&%T92(-"B`@("`@($1A=&%+97E&:65L9#TB875?:60B#0H@("`@("!!

M=71O1V5N97)A=&5#;VQU;6YS/2)F86QS92(-"B`@("`^#0H-"B`@("`@(#QP

M<F]P97)T>2!N86UE/2)#;VQU;6YS(CX-"B`@("`@("`@/&%S<#I%9&ET0V]M

M;6%N9$-O;'5M;B!%9&ET5&5X=#TB161I="(@0V%N8V5L5&5X=#TB0V%N8V5L

M(B!5<&1A=&5497AT/2)5<&1A=&4B("!)=&5M4W1Y;&4M5W)A<#TB9F%L<V4B

M+SX-"B`@("`@("`@/&%S<#I";W5N9$-O;'5M;B!(96%D97)497AT/2)A=5]I

M9"(@4V]R=$9I96QD/2)A=5]I9"(@4F5A9$]N;'D](E1R=64B($1A=&%&:65L

M9#TB875?:60B($ET96U3='EL92U7<F%P/2)F86QS92(O/@T*("`@("`@("`\

M87-P.E1E;7!L871E0V]L=6UN($AE861E<E1E>'0](F%U7VQN86UE(B!3;W)T

M1FEE;&0](F%U7VQN86UE(CX-"B`@("`@("`@("`\=&5M<&QA=&4@;F%M93TB

M271E;51E;7!L871E(CX-"B`@("`@("`@("`@(#QA<W`Z3&%B96P@<G5N870]

M(G-E<G9E<B(@5&5X=#TG/"4C($1A=&%":6YD97(N179A;"A#;VYT86EN97(N

M1&%T84ET96TL(")A=5]L;F%M92(I("4^)R\^#0H@("`@("`@("`@/"]T96UP

M;&%T93X-"B`@("`@("`@("`\=&5M<&QA=&4@;F%M93TB161I=$ET96U496UP

M;&%T92(^#0H@("`@("`@("`@("`\87-P.E1E>'1";W@@<G5N870](G-E<G9E

M<B(@:60](F5D:71?3$YA;64B(%1E>'0])SPE(R!$871A0FEN9&5R+D5V86PH

M0V]N=&%I;F5R+D1A=&%)=&5M+"`B875?;&YA;64B*2`E/B<O/@T*("`@("`@

M("`@(#PO=&5M<&QA=&4^#0H@("`@("`@(#PO87-P.E1E;7!L871E0V]L=6UN

M/@T*("`@("`@("`\87-P.E1E;7!L871E0V]L=6UN($AE861E<E1E>'0](F%U

M7V9N86UE(B!3;W)T1FEE;&0](F%U7V9N86UE(CX-"B`@("`@("`@("`\=&5M

M<&QA=&4@;F%M93TB271E;51E;7!L871E(CX-"B`@("`@("`@("`@(#QA<W`Z

M3&%B96P@<G5N870](G-E<G9E<B(@5&5X=#TG/"4C($1A=&%":6YD97(N179A

M;"A#;VYT86EN97(N1&%T84ET96TL(")A=5]F;F%M92(I("4^)R\^#0H@("`@

M("`@("`@/"]T96UP;&%T93X-"B`@("`@("`@("`\=&5M<&QA=&4@;F%M93TB

M161I=$ET96U496UP;&%T92(^#0H@("`@("`@("`@("`\87-P.E1E>'1";W@@

M<G5N870](G-E<G9E<B(@:60](F5D:71?1DYA;64B(%1E>'0])SPE(R!$871A

M0FEN9&5R+D5V86PH0V]N=&%I;F5R+D1A=&%)=&5M+"`B875?9FYA;64B*2`E

M/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@("`@(#PO87-P.E1E

M;7!L871E0V]L=6UN/@T*("`@("`@("`\87-P.E1E;7!L871E0V]L=6UN($AE

M861E<E1E>'0](G!H;VYE(B!3;W)T1FEE;&0](G!H;VYE(CX-"B`@("`@("`@

M("`\=&5M<&QA=&4@;F%M93TB271E;51E;7!L871E(CX-"B`@("`@("`@("`@

M(#QA<W`Z3&%B96P@<G5N870](G-E<G9E<B(@5&5X=#TG/"4C($1A=&%":6YD

M97(N179A;"A#;VYT86EN97(N1&%T84ET96TL(")P:&]N92(I("4^)R\^#0H@

M("`@("`@("`@/"]T96UP;&%T93X-"B`@("`@("`@("`\=&5M<&QA=&4@;F%M

M93TB161I=$ET96U496UP;&%T92(^#0H@("`@("`@("`@("`\87-P.E1E>'1"

M;W@@<G5N870](G-E<G9E<B(@:60](F5D:71?4&AO;F4B(%1E>'0])SPE(R!$

M871A0FEN9&5R+D5V86PH0V]N=&%I;F5R+D1A=&%)=&5M+"`B<&AO;F4B*2`E

M/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@("`@(#PO87-P.E1E

M;7!L871E0V]L=6UN/@T*("`@("`@("`\87-P.E1E;7!L871E0V]L=6UN($AE

M861E<E1E>'0](F%D9')E<W,B(%-O<G1&:65L9#TB861D<F5S<R(^#0H@("`@

M("`@("`@/'1E;7!L871E(&YA;64](DET96U496UP;&%T92(^#0H@("`@("`@

M("`@("`\87-P.DQA8F5L(')U;F%T/2)S97)V97(B(%1E>'0])SPE(R!$871A

M0FEN9&5R+D5V86PH0V]N=&%I;F5R+D1A=&%)=&5M+"`B861D<F5S<R(I("4^

M)R\^#0H@("`@("`@("`@/"]T96UP;&%T93X-"B`@("`@("`@("`\=&5M<&QA

M=&4@;F%M93TB161I=$ET96U496UP;&%T92(^#0H@("`@("`@("`@("`\87-P

M.E1E>'1";W@@<G5N870](G-E<G9E<B(@:60](F5D:71?061D<F5S<R(@5&5X

M=#TG/"4C($1A=&%":6YD97(N179A;"A#;VYT86EN97(N1&%T84ET96TL(")A

M9&1R97-S(BD@)3XG+SX-"B`@("`@("`@("`\+W1E;7!L871E/@T*("`@("`@

M("`\+V%S<#I496UP;&%T94-O;'5M;CX-"B`@("`@("`@/&%S<#I496UP;&%T

M94-O;'5M;B!(96%D97)497AT/2)C:71Y(B!3;W)T1FEE;&0](F-I='DB/@T*

M("`@("`@("`@(#QT96UP;&%T92!N86UE/2))=&5M5&5M<&QA=&4B/@T*("`@

M("`@("`@("`@/&%S<#I,86)E;"!R=6YA=#TB<V5R=F5R(B!497AT/2<\)2,@

M1&%T84)I;F1E<BY%=F%L*$-O;G1A:6YE<BY$871A271E;2P@(F-I='DB*2`E

M/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@("`@("`@/'1E;7!L

M871E(&YA;64](D5D:71)=&5M5&5M<&QA=&4B/@T*("`@("`@("`@("`@/&%S

M<#I497AT0F]X(')U;F%T/2)S97)V97(B(&ED/2)E9&ET7T-I='DB(%1E>'0]

M)SPE(R!$871A0FEN9&5R+D5V86PH0V]N=&%I;F5R+D1A=&%)=&5M+"`B8VET

M>2(I("4^)R\^#0H@("`@("`@("`@/"]T96UP;&%T93X-"B`@("`@("`@/"]A

M<W`Z5&5M<&QA=&5#;VQU;6X^#0H@("`@("`@(#QA<W`Z5&5M<&QA=&5#;VQU

M;6X@2...&5A9&5R5&5X=#TB<W1A=&4B(%-O<G1&:65L9#TB<W1A=&4B/@T*("`@

M("`@("`@(#QT96UP;&%T92!N86UE/2))=&5M5&5M<&QA=&4B/@T*("`@("`@

M("`@("`@/&%S<#I,86)E;"!R=6YA=#TB<V5R=F5R(B!497AT/2<\)2,@1&%T

M84)I;F1E<BY%=F%L*$-O;G1A:6YE<BY$871A271E;2P@(G-T871E(BD@)3XG

M+SX-"B`@("`@("`@("`\+W1E;7!L871E/@T*("`@("`@("`@(#QT96UP;&%T

M92!N86UE/2)%9&ET271E;51E;7!L871E(CX-"B`@("`@("`@("`@(#QA<W`Z

M1')O<$1O=VY,:7-T(')U;F%T/2)S97)V97(B($1A=&%3;W5R8V4](CPE(R!3

M=&%T94EN9&5X("4^(B!396QE8W1E9$EN9&5X/2<\)2,@1V5T4W1A=&5);F1E

M>"@H4W1R:6YG*2@H...&%T85)O=U9I97<I0V]N=&%I;F5R+D1A=&%)=&5M*5LB

M<W1A=&4B72D@)3XG(&ED/2)E9&ET7U-T871E(CX-"B`@("`@("`@("`@(#PO

M87-P.D1R;W!$;W=N3&ES=#X-"B`@("`@("`@("`\+W1E;7!L871E/@T*("`@

M("`@("`\+V%S<#I496UP;&%T94-O;'5M;CX-"B`@("`@("`@/&%S<#I496UP

M;&%T94-O;'5M;B!(96%D97)497AT/2)Z:7`B(%-O<G1&:65L9#TB>FEP(CX-

M"B`@("`@("`@("`\=&5M<&QA=&4@;F%M93TB271E;51E;7!L871E(CX-"B`@

M("`@("`@("`@(#QA<W`Z3&%B96P@<G5N870](G-E<G9E<B(@5&5X=#TG/"4C

M($1A=&%":6YD97(N179A;"A#;VYT86EN97(N1&%T84ET96TL(")Z:7`B*2`E

M/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@("`@("`@/'1E;7!L

M871E(&YA;64](D5D:71)=&5M5&5M<&QA=&4B/@T*("`@("`@("`@("`@/&%S

M<#I497AT0F]X(')U;F%T/2)S97)V97(B(&ED/2)E9&ET7UII<"(@5&5X=#TG

M/"4C($1A=&%":6YD97(N179A;"A#;VYT86EN97(N1&%T84ET96TL(")Z:7`B

M*2`E/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@("`@(#PO87-P

M.E1E;7!L871E0V]L=6UN/@T*("`@("`@("`\87-P.E1E;7!L871E0V]L=6UN

M($AE861E<E1E>'0](F-O;G1R86-T(B!3;W)T1FEE;&0](F-O;G1R86-T(CX-

M"B`@("`@("`@("`\=&5M<&QA=&4@;F%M93TB271E;51E;7!L871E(CX-"B`@

M("`@("`@("`@(#QA<W`Z3&%B96P@<G5N870](G-E<G9E<B(@5&5X=#TG/"4C

M($1A=&%":6YD97(N179A;"A#;VYT86EN97(N1&%T84ET96TL(")C;VYT<F%C

M="(L(")[,'TB*2`E/B<O/@T*("`@("`@("`@(#PO=&5M<&QA=&4^#0H@("`@

M("`@("`@/'1E;7!L871E(&YA;64](D5D:71)=&5M5&5M<&QA=&4B/@T*("`@

M("`@("`@("`@/&%S<#I#:&5C:T)O>"!R=6YA=#TB<V5R=F5R(B!I9#TB961I

M=%]#;VYT<F%C="(@0VAE8VME9#TG/"4C($1A=&%":6YD97(N179A;"A#;VYT

M86EN97(N1&%T84ET96TL(")C;VYT<F%C="(I("4^)R\^#0H@("`@("`@("`@

M/"]T96UP;&%T93X-"B`@("`@("`@/"]A<W`Z5&5M<&QA=&5#;VQU;6X^#0H@

M("`@("`\+W!R;W!E<G1Y/@T*#0H@("`@/"]!4U`Z1&%T84=R:60^#0H-"B`@

?/"]F;W)M/@T*#0H\+V)O9'D^#0H\+VAT;6P^#0H-"@==

`

end

Message #5 by "Christine Anwar" <christine.anwar@i...> on Thu, 7 Dec 2000 01:31:21 -0800
Thanks So Much it works........



Christine



-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks














Message #6 by "Christine Anwar" <christine.anwar@i...> on Thu, 7 Dec 2000 03:20:58 -0800
Thanks again for your help



I want to ask another question please...



the SelectedIndex field of the DopDownList

is not working and it always raises an unhandeld exception error



Do you have any suggestions concerning this problem ???



Thanks

Christine

-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks














Message #7 by Susan Warren <swarren@m...> on Thu, 7 Dec 2000 06:02:51 -0800
Hard to say without seeing the text of the exception and the code that 1)

fills the list and 2) gets the selected index.  

Can you attach this information?



thanks,

Susan



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Thursday, December 07, 2000 3:21 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks again for your help



I want to ask another question please...



the SelectedIndex field of the DopDownList

is not working and it always raises an unhandeld exception error



Do you have any suggestions concerning this problem ???



Thanks

Christine

-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks





Message #8 by Jamie Steele <JSteele@P...> on Thu, 7 Dec 2000 09:13:39 -0500
Send your code so we can have a look. I have used the SelectedIndex property

with no problems.



James Steele



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Thursday, December 07, 2000 6:21 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks again for your help



I want to ask another question please...



the SelectedIndex field of the DopDownList

is not working and it always raises an unhandeld exception error



Do you have any suggestions concerning this problem ???



Thanks

Christine

-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks





Message #9 by "Christine Anwar" <christine.anwar@i...> on Thu, 7 Dec 2000 06:40:10 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_0013_01C06018.8C2DFE80

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



This is a copy of my code

Thanks



-----Original Message-----

From: Jamie Steele [mailto:JSteele@P...]

Sent: Thursday, December 07, 2000 6:14 AM

To: ASP+

Subject: [aspx] RE: Help





Send your code so we can have a look. I have used the SelectedIndex property

with no problems.



James Steele



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Thursday, December 07, 2000 6:21 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks again for your help



I want to ask another question please...



the SelectedIndex field of the DopDownList

is not working and it always raises an unhandeld exception error



Do you have any suggestions concerning this problem ???



Thanks

Christine

-----Original Message-----

From: Susan Warren [mailto:swarren@m...]



Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks












------=_NextPart_000_0013_01C06018.8C2DFE80

Content-Type: application/octet-stream;

	name="EditProject.aspx"

Content-Transfer-Encoding: quoted-printable

Content-Disposition: attachment;

	filename="EditProject.aspx"



<%@ Import Namespace=3D"System.Data" %>

<%@ Import Namespace=3D"System.Data.SQL" %>



<html>



<script language=3D"C#" runat=3D"server" ID=3DScript1>



    SQLConnection myConnection =3D new 

SQLConnection("server=3Dmanal-milad;uid=3DMena;pwd=3D;database=3DBugBaseD

B");           

    public ArrayList NameIndex;



    protected void Page_Load(Object Src, EventArgs E)

    {

        myConnection =3D new 

SQLConnection("server=3Dmanal-milad;uid=3DMena;pwd=3D;database=3DBugBaseD

B");           

           

       if (!IsPostBack)

          BindGrid();



        NameIndex =3D new ArrayList();

        SQLDataReader dr;



        //populate arraylist from database

        SQLCommand myCommand =3D new SQLCommand("select UserID, UserName 

from Users", myConnection);

        myConnection.Open();

        myCommand.Execute(out dr);



        while (dr.Read())

        {

            NameIndex.Add (dr["UserName"]);

        }



        myConnection.Close();

    }



	String GetUserName(int number) {           

    String selectCmd =3D "select UserName from Users where UserID =3D 

@number";

   

    SQLDataSetCommand myCommand =3D new SQLDataSetCommand(selectCmd, 

myConnection);

   

    myCommand.SelectCommand.Parameters.Add(new SQLParameter("@number", 

SQLDataType.Int, 4));

    myCommand.SelectCommand.Parameters["@number"].Value =3D number ;

   

   

    DataSet ds =3D new DataSet();

    myCommand.FillDataSet(ds, "Users");

               

    return ds.Tables["Users"].Rows[0]["UserName"].ToString ();

	}

=09

    public int GetOwner (String uname)

    {   

		myConnection =3D new 

SQLConnection("server=3Dmanal-milad;uid=3DMena;pwd=3D;database=3DBugBaseD

B");           

		String selectCommand =3D "select UserID from Users where UserName =3D 

@uname";

        SQLDataSetCommand myComd =3D new 

SQLDataSetCommand(selectCommand, myConnection);

       

        myComd.SelectCommand.Parameters.Add(new SQLParameter("@uname", 

SQLDataType.Char, 20));

		myComd.SelectCommand.Parameters["@uname"].Value =3D uname;

               

        DataSet ds =3D new DataSet();

        myComd.FillDataSet(ds, "Users");

        String str =3D ds.Tables["Users"].Rows[0]["UserID"].ToString ();	

					=09

        int num =3D str.ToInt32();

        return num;

				       

     }  

    

   



    public void MyDataGrid_Edit(Object sender, DataGridCommandEventArgs 

E)

    {         =09

        MyDataGrid.EditItemIndex =3D (int)E.Item.ItemIndex;

        BindGrid();

    }

       

    public void MyDataGrid_Cancel(Object sender, 

DataGridCommandEventArgs E)

    {

        MyDataGrid.EditItemIndex =3D -1;

        BindGrid();

    }

   

	public String GetProName(String proName) {

	return proName;

	}

=09

	public bool isSamePro (Object sender, DataGridCommandEventArgs E)

	{=09

=09

	if (((TextBox)E.Item.Cells[2].Controls[0]).Text =3D=3D "" )

	{

	Message.InnerHtml =3D "Error: You have to specify a project name.";

	Message.Style["color"] =3D "red";

	return true;

	}else

	{

		SQLDataSetCommand getCommand =3D new SQLDataSetCommand("select 

ProjName from Projects where ProjID =3D @PID", myConnection);

		

		getCommand.SelectCommand.Parameters.Add(new SQLParameter("@PID", 

SQLDataType.Int, 4));

		getCommand.SelectCommand.Parameters["@PID"].Value =3D 

MyDataGrid.DataKeys[(int)E.Item.ItemIndex];

       

		DataSet ds =3D new DataSet();

              

		getCommand.FillDataSet(ds, "Projects");						 			=09

	=09

		String str =3D ds.Tables["Projects"].Rows[0]["ProjName"].ToString ();		

				=09

		String str1 =3D "";

		str1 =3D ((TextBox)E.Item.Cells[2].Controls[0]).Text;

		if (str	!=3D str1)

		{

			SQLDataSetCommand getCom =3D new SQLDataSetCommand("select ProjName 

from Projects where ProjName =3D @PName", myConnection);

		

			getCom.SelectCommand.Parameters.Add(new SQLParameter("@PName", 

SQLDataType.VarChar, 30));

			getCom.SelectCommand.Parameters["@PName"].Value =3D 

((TextBox)E.Item.Cells[2].Controls[0]).Text;

       

			DataSet ds1 =3D new DataSet();

              

			getCom.FillDataSet(ds1, "Projects");						 			=09

			try

			{

				String mystr =3D ds1.Tables["Projects"].Rows[0]["ProjName"].ToString 

();			=09

				Message.InnerHtml =3D "Error: A Project with the same name has been 

found.";

				Message.Style["color"] =3D "red";

				return true;

			}

			catch (System.IndexOutOfRangeException myexp)

			{

			return false;

			}

	=09

		}else	=09

		return false;

		}

		return false;

	}

=09

    public void MyDataGrid_Update(Object sender, 

DataGridCommandEventArgs E)

   {         

		if (! isSamePro (sender,E))

		{

			String updateCmd =3D "UPDATE Projects SET ProjName =3D @PName, 

ProjOwner =3D @POwner where ProjID =3D @PId";

			SQLCommand myCommand =3D new SQLCommand(updateCmd, myConnection);

=09

			myCommand.Parameters.Add(new SQLParameter("@PId", SQLDataType.Int, 

4));

			myCommand.Parameters["@PId"].Value =3D 

MyDataGrid.DataKeys[(int)E.Item.ItemIndex];

  

			myCommand.Parameters.Add(new SQLParameter("@PName", 

SQLDataType.VarChar, 30));

			myCommand.Parameters["@PName"].Value =3D 

((TextBox)E.Item.Cells[2].Controls[0]).Text;

		=09

		   String name =3D "";

           name =3D 

((DropDownList)E.Item.FindControl("DropDown1")).SelectedItem.ToString();

           myCommand.Parameters.Add(new SQLParameter("@POwner", 

SQLDataType.Int, 4));

		   myCommand.Parameters["@POwner"].Value =3D GetOwner(name);

		  

		   myCommand.ActiveConnection.Open();



			try

			{

				myCommand.Execute();

				Message.InnerHtml =3D "<b>Record Updated</b><br>";		=09

			}

			catch (SQLException e)

			{

				if (e.Number =3D=3D 2627)

                Message.InnerHtml =3D "ERROR: A record already exists 

with the same primary key";

				else

				Message.InnerHtml =3D "ERROR: Could not update record, please ensure 

the fields are correctly filled out";

				Message.Style["color"] =3D "red";

			}	=09

        myCommand.ActiveConnection.Close();        			          

		}

	   MyDataGrid.EditItemIndex =3D -1;

	   BindGrid();       

    }



    public void BindGrid()

    {

        SQLDataSetCommand myCommand =3D new SQLDataSetCommand("select * 

from Projects", myConnection);



        DataSet ds =3D new DataSet();

        myCommand.FillDataSet(ds, "Projects");



        MyDataGrid.DataSource=3Dds.Tables["Projects"].DefaultView;

        MyDataGrid.DataBind();

                   

    }

public int GetOwnerIndex (int num)

{

return num;

}

</script>



<body style=3D"font: 10pt verdana">



  <form runat=3D"server" ID=3DForm1>



    <h3><font face=3D"Verdana">Edit An Existing Project</font></h3>



    <span id=3D"Message" MaintainState=3D"false" style=3D"font: arial 

11pt;" runat=3D"server"/><p>



       

    <ASP:DataGrid id=3D"MyDataGrid" runat=3D"server"

      Width=3D"800"

      BackColor=3D"#ccccff"

      BorderColor=3D"black"

      ShowFooter=3D"false"

      CellPadding=3D3

      CellSpacing=3D"0"

      Font-Name=3D"Verdana"

      Font-Size=3D"8pt"

      HeaderStyle-BackColor=3D"#aaaadd"

      OnEditCommand=3D"MyDataGrid_Edit"

      OnCancelCommand=3D"MyDataGrid_Cancel"

      OnUpdateCommand=3D"MyDataGrid_Update"

      AutoGenerateColumns=3D"false"     

      DataKeyField=3D"ProjID"     

   >



           

      <property name=3D"Columns">

        <asp:EditCommandColumn EditText=3D"Edit" CancelText=3D"Cancel" 

UpdateText=3D"Update"  ItemStyle-Wrap=3D"false"/>

        <asp:BoundColumn HeaderText=3D"Project ID" SortField=3D"ProjID" 

ReadOnly=3D"True" DataField=3D"ProjID" ItemStyle-Wrap=3D"false"/>        

      

		<asp:BoundColumn HeaderText=3D"Project Name" SortField=3D"ProjName" 

DataField=3D"ProjName"/>           

         <asp:TemplateColumn HeaderText=3D"Project Owner" 

SortField=3D"ProjOwner">                       

          <template name=3D"ItemTemplate">           

          <asp:Label runat=3D"server" Text=3D'<%# 

GetUserName((int)((DataRowView)Container.DataItem)["ProjOwner"]) %>'/>   

      

          </template>

          <template name=3D"EditItemTemplate">         

            <asp:DropDownList id=3D"DropDown1" DataSource=3D"<%# 

NameIndex %>" runat=3D"server" SelectedIndex=3D'<%# 

GetOwnerIndex((int)((DataRowView)Container.DataItem)["ProjOwner"]) %>' 

/>                                                            

          </template>

        </asp:TemplateColumn>

       

      </property>

           

    </ASP:DataGrid>



  </form>



</body>

</html>





------=_NextPart_000_0013_01C06018.8C2DFE80--



Message #10 by "Michael Gaertner" <mgaert@b...> on Thu, 7 Dec 2000 11:07:30 -0500
Could one of you forward the EditProject.aspx to me directly. All I get is a

bunch of MIME stuff. I've been pounding the keys trying to Data bind inside

a Container!



Thanks.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Thursday, December 07, 2000 4:31 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks So Much it works........



Christine



-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 9:33 AM

To: ASP+

Subject: [aspx] RE: Help





My apologies to everyone... I thought one of these samples was using

databinding to populate the dropdown.  They weren't, so I modified one of

them to do so.  See attached.



Some things to note:



1. When you select a row to edit the State field shows a dropdownlist of

valid states

2. The dropdown is bound to a public field of type ArrayList on the page

called "StateIndex".  This is populated when you call DataBind() on the

grid.

3. StateIndex is populated via a call to the database, which returns a

datareader, and in turn is used to fill the ArrayList.  This happens on

page_load.



this example is not optimal perf-wise.  Since StateIndex is relatively

static, you'd probably push it into the cache so the page wouldn't hit the

database on every request (there's an example of this in the _menu.ascx user

control in IBuySpy).  But the example does illustrate what you are after:

it *is* possible to bind items within a templated list to other public

members of the page, not just Container.DataItem().



hope this helps,

Susan





-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:54 AM

To: ASP+

Subject: [aspx] RE: Help





Thanks for your reply



I saw this samples before..

the DropDownLists in these example are not part of the DataGrid, besides

that

the contect of these dropdownlists is hardcoded .. and i would like to fill

the dropdownlists in the datagrid with daynamic data that I get from the

database...



Can anybody help please





-----Original Message-----

From: Susan Warren [mailto:swarren@m...]

Sent: Wednesday, December 06, 2000 7:28 AM

To: ASP+

Subject: [aspx] RE: Help





This must be the question du jour!  Here's the answer I sent about a half an

hour ago:



There are two samples in the .NET Quickstart (this installs as part of the

.NET SDK documentation; there's an online copy available at

http://gotdotnet.com/quickstart/aspplus if you haven't set them up) that do

exactly what you are after.  See the ASP.NET Web Forms > Server Side Data

Access topics, samples DataGrid5 and DataGrid6.



-----Original Message-----

From: Christine Anwar [mailto:christine.anwar@i...]

Sent: Wednesday, December 06, 2000 7:27 AM

To: ASP+

Subject: [aspx] Help





Anybody knows how to embed a DropDownList into a DataGrid ???



Thanks


  Return to Index