Click here to Skip to main content
15,891,431 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: PDF Pin
Ernest Laurentin15-May-08 4:28
Ernest Laurentin15-May-08 4:28 
AnswerThird post Pin
leckey15-May-08 4:29
leckey15-May-08 4:29 
Questionhow to create a session for a loging user? Pin
sandy005315-May-08 2:48
sandy005315-May-08 2:48 
AnswerRe: how to create a session for a loging user? Pin
Sandeep Kumar15-May-08 3:05
Sandeep Kumar15-May-08 3:05 
AnswerRe: how to create a session for a loging user? Pin
eyeseetee15-May-08 3:16
eyeseetee15-May-08 3:16 
QuestionPDF component Pin
Imthu15-May-08 2:48
Imthu15-May-08 2:48 
AnswerRe: PDF component Pin
J a a n s15-May-08 4:53
professionalJ a a n s15-May-08 4:53 
QuestionHtmlInputHidden in a datagrid loses it's value after postback [modified] Pin
thomasa15-May-08 2:35
thomasa15-May-08 2:35 
I have a datagrid that contains an HtmlInputHidden, something like:
<asp:datagrid id="dgCurrency" runat="server" CssClass="grid" AllowPaging="False" CellPadding="0"<br />
                                GridLines="Vertical" AutoGenerateColumns="False" ShowFooter="false" ><br />
                                                                <Columns>	<br />
                                    <asp:TemplateColumn HeaderText="ISO kode" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="150px"><br />
                                        <ItemStyle HorizontalAlign="Left" VerticalAlign="Top"></ItemStyle><br />
                                        <ItemTemplate><br />
                                            <asp:Label id="lblISOCode" runat="server" CssClass="tbStyle1"><br />
                                                <%#DataBinder.Eval(Container.DataItem, "strISOCode").ToString()%>						                        <br />
                                            </asp:Label><br />
                                            <input type="hidden" runat="server" id="inCurrencyID" value='<%#DataBinder.Eval(Container.DataItem, "lngCurrencyID").ToString()%>' />	<br />
                                        </ItemTemplate><br />
                                    </asp:TemplateColumn><br />
...


Where the inCurrencyID is my HtmlInputHidden.

At the first time my page loads, I add a DataView to the dgCurrency datasource.
When I push a button the first time, the inCurrencyID has it's value, as in:
foreach (DataGridItem dgi in dgCurrency.Items)<br />
                {<br />
                    inCurrencyID = (HtmlInputHidden)dgi.FindControl("inCurrencyID");<br />
<br />
                    int lngCurrencyID = int.Parse(inCurrencyID.Value);<br />
...


After this I don't databind the dgCurrency to a new datasource, I just leave it as it is.

Now the next time I push the same button, it has now lost it's value????
The same goes for the label lblISOCode.

The strange thing is that I also have an TextBox in the DataGrid, and that control stil have it's Text.

Dose anyone know why, or is there another hidden fild that I can use that dosen't lose it's value on a PostBack without a databind()?

Thanks
Thomas

modified on Thursday, May 15, 2008 9:47 AM

AnswerRe: HtmlInputHidden in a datagrid loses it's value after postback Pin
TheWirelessGuy15-May-08 9:09
TheWirelessGuy15-May-08 9:09 
QuestionHow to fech records from Dataset Pin
sjs4u15-May-08 2:05
sjs4u15-May-08 2:05 
AnswerRe: How to fech records from Dataset Pin
eyeseetee15-May-08 3:12
eyeseetee15-May-08 3:12 
Questionmessage box problem in code behind Pin
Pankaj Garg15-May-08 1:33
Pankaj Garg15-May-08 1:33 
AnswerRe: message box problem in code behind Pin
SamRST15-May-08 1:58
SamRST15-May-08 1:58 
GeneralRe: message box problem in code behind Pin
Pankaj Garg15-May-08 2:05
Pankaj Garg15-May-08 2:05 
QuestionRemote Scripting with IFRAME Pin
Piyush Vardhan Singh15-May-08 1:30
Piyush Vardhan Singh15-May-08 1:30 
AnswerRe: Remote Scripting with IFRAME Pin
TheWirelessGuy15-May-08 9:15
TheWirelessGuy15-May-08 9:15 
QuestioniTextObject control in crystal report Pin
Pankaj Garg15-May-08 1:25
Pankaj Garg15-May-08 1:25 
AnswerRe: iTextObject control in crystal report Pin
SamRST15-May-08 1:59
SamRST15-May-08 1:59 
QuestionRe: iTextObject control in crystal report Pin
Pankaj Garg15-May-08 2:07
Pankaj Garg15-May-08 2:07 
QuestionImage button in Gridview Pin
danasegaranea15-May-08 1:17
danasegaranea15-May-08 1:17 
AnswerRe: Image button in Gridview Pin
SamRST15-May-08 2:04
SamRST15-May-08 2:04 
GeneralRe: Image button in Gridview Pin
danasegaranea15-May-08 2:16
danasegaranea15-May-08 2:16 
GeneralRe: Image button in Gridview Pin
_AK_15-May-08 20:29
_AK_15-May-08 20:29 
AnswerRe: Image button in Gridview Pin
Gayani Devapriya15-May-08 8:35
Gayani Devapriya15-May-08 8:35 
Questionurl encode with '+' Pin
g00fyman15-May-08 1:03
g00fyman15-May-08 1:03 

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.