Click here to Skip to main content
16,007,809 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Jim Matthews8-Mar-05 7:05
Jim Matthews8-Mar-05 7:05 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Lisana8-Mar-05 10:47
Lisana8-Mar-05 10:47 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Anonymous9-Mar-05 20:44
Anonymous9-Mar-05 20:44 
AnswerRe: How can I hide a column value from view in my Datagrid Pin
westerdlyOne_void8-Mar-05 10:46
westerdlyOne_void8-Mar-05 10:46 
QuestionHow to access serial Com Port 1 for ASP.net / VB.NEt Pin
Member 11682817-Mar-05 4:55
Member 11682817-Mar-05 4:55 
AnswerRe: How to access serial Com Port 1 for ASP.net / VB.NEt Pin
Dave Kreskowiak7-Mar-05 7:07
mveDave Kreskowiak7-Mar-05 7:07 
General[ASP.NET / VB.NET] using Page Templates disables DataGrid events Pin
Mastakilla1237-Mar-05 0:57
Mastakilla1237-Mar-05 0:57 
GeneralRe: [ASP.NET / VB.NET] using Page Templates disables DataGrid events Pin
Mastakilla1237-Mar-05 4:02
Mastakilla1237-Mar-05 4:02 
i just found this on http://www.jroller.com/page/CoBraLorD/20040812#asp_net_datagrid_events_not

ASP.NET: DataGrid events not firing without ViewState ?  ( 12 aug 2004, 10:53:02 CEST )<br />
Many of us ASP.NET developers must have had this problems, DataGrid events don't fire unless you enable viewstate on the datagrid, or you rebind it on every page load (so before the eventhandler gets called). Viewstate can be a nasty thing, especially in combination with a datagrid, and since I have to target low bandwith users, I tend to drop the viewstate for my datagrids. <br />
<br />
So I must rebind the datagrid on every page load if I want to be able to catch events originating from a child control inside it. Reason for this: the controls inside a datagrid (like for example a LinkButton for every item) are only created when the data is actually bound. Let's say an ItemCommand is launched by clicking on a linkbutton in the datagrid. The page gets loaded on the other side, but its a postback and you don't databind() the grid (and viewstate is disabled). After the basic page load, the UI Page class will look for the control that raised the event, but, it won't find it since it has not yet been created. In the end the eventhandler will not get called. <br />
<br />
Now, if you don't want viewstate, a databind on every page load works fine in most cases. However, what if you have a very expensive query to fill up your datagrid. Or say you have a datagrid on a page, along with another set of buttons. Each of the buttons raises an event, but those events will navigate away from the page, so you definitely won't see that datagrid anymore. It's pretty damn annoying to end up loading the whole datagrid data ANYWAY, just to be able to handle that button click that immediately moves away from the current page. That's seriously one wasted query. <br />
<br />
However, there is a solution, and in fact, it's pretty easy !<br />
What you want to is basically intercept on what control an event is being called, and then decide if you should bind data to be able to actually 'catch' the event. For example: we know if an event is being called on any child control of our datagrid, we must rebind the datagrid first. If an event is being called on one of our buttons, we know we will simply redirect and we don't need to bind the datagrid for that. <br />
<br />
The answer is __EVENTTARGET. The event target is a request parameter that gets set automatically on the postback of a form. It is either set in the querystring or form collection (depending on your form method). In case of a control *inside* another control being called, the event target will show you something of the form 'XXXX:_ctl1:_ctl2...' where XXXX is the ID of a control you created manually. So, if you were to have a datagrid called dgUserList, a linkbutton event could very well be of the form dgUserList:_ctl2:_ctl0. <br />
<br />
What you could do then is in the Page_Load method, get the __EVENTTARGET value (you can easily use Request.Params instead of checking for both Form and QueryString separately) and check if the string dgUserList is somewhere in there (or if it starts with it). If so, we can be sure we need to rebind the datalist, else we're sure we don't have to, just to be able to handle the event. This allows you a more fine-grained control over when to rebind data to controls, and it can gain you some performance if your application would demand it. <br />
<br />
You could go quite far with this, actually linking up databinding with a set of events, before the actual eventhandlers are being executed. 


it seems to go about the same problem, only i dont understand the solution and i still didnt get it working

also my viewstate is allready true, so i dont really understand why im having this problem?
QuestionHow to read a word under mouse cursor? Pin
RABEE SHAHEEN6-Mar-05 23:40
RABEE SHAHEEN6-Mar-05 23:40 
AnswerRe: How to read a word under mouse cursor? Pin
Dave Kreskowiak7-Mar-05 7:17
mveDave Kreskowiak7-Mar-05 7:17 
QuestionBitMap &amp; Graphics, please HELP!? Pin
Acheto6-Mar-05 23:28
Acheto6-Mar-05 23:28 
Answerplease HELP!? Pin
Acheto8-Mar-05 8:02
Acheto8-Mar-05 8:02 
GeneralIs a Question like this Thread too BAD for this Forum? Pin
Acheto10-Mar-05 0:21
Acheto10-Mar-05 0:21 
GeneralTimetable scheduling algorithms Pin
Member 45821056-Mar-05 23:21
Member 45821056-Mar-05 23:21 
GeneralRe: Timetable scheduling algorithms Pin
Dave Kreskowiak7-Mar-05 1:12
mveDave Kreskowiak7-Mar-05 1:12 
GeneralProblem referencing COM+'s Web services via VS.NET Pin
twlong6-Mar-05 21:10
twlong6-Mar-05 21:10 
GeneralSnap-ins and Windows Service Pin
CSharpBala6-Mar-05 19:15
CSharpBala6-Mar-05 19:15 
QuestionRelation between Webrowser control and IE (or FireFox or Opera) ? Pin
mecracked6-Mar-05 18:57
sussmecracked6-Mar-05 18:57 
GeneralDisplaying which month of the year Pin
cpod6-Mar-05 18:28
cpod6-Mar-05 18:28 
GeneralRe: Displaying which month of the year Pin
Robert Rohde6-Mar-05 20:23
Robert Rohde6-Mar-05 20:23 
GeneralRe: Displaying which month of the year Pin
cpod7-Mar-05 4:03
cpod7-Mar-05 4:03 
GeneralDeploy VB.Net App w/Crystal Rpts Pin
jtex6-Mar-05 15:52
jtex6-Mar-05 15:52 
GeneralRPC Server Unavailable Pin
MagicGirL836-Mar-05 13:02
MagicGirL836-Mar-05 13:02 
GeneralRe: RPC Server Unavailable Pin
Robert Rohde6-Mar-05 20:27
Robert Rohde6-Mar-05 20:27 
GeneralRe: RPC Server Unavailable Pin
Dave Kreskowiak7-Mar-05 1:07
mveDave Kreskowiak7-Mar-05 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.