<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DevX.com Forums - ASP.NET</title>
		<link>http://forums.devx.com</link>
		<description>Issues related to the Active Server Pages Web server
platform from Microsoft.</description>
		<language>en</language>
		<lastBuildDate>Sun, 22 Nov 2009 01:42:07 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.devx.com/images/misc/rss.jpg</url>
			<title>DevX.com Forums - ASP.NET</title>
			<link>http://forums.devx.com</link>
		</image>
		<item>
			<title>Report not showing next page in ASP.net</title>
			<link>http://forums.devx.com/showthread.php?t=173361&amp;goto=newpost</link>
			<pubDate>Fri, 13 Nov 2009 03:29:28 GMT</pubDate>
			<description>Hi, i have this problem

i create a crystal report and show it in ASP.net. by using vb.net, i set some code to assign datasource to report at PageInit events so that when i click next page of report then it will show. all process done in development PC, but when i upload to testing server, it *will not show *once i click next page button of the report. but after i click again the submit report button again then it will show second page of report to me.

please help me on this problem... thanks~~</description>
			<content:encoded><![CDATA[<div>Hi, i have this problem<br />
<br />
i create a crystal report and show it in ASP.net. by using vb.net, i set some code to assign datasource to report at PageInit events so that when i click next page of report then it will show. all process done in development PC, but when i upload to testing server, it <b>will not show </b>once i click next page button of the report. but after i click again the submit report button again then it will show second page of report to me.<br />
<br />
please help me on this problem... thanks~~</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>nigege</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173361</guid>
		</item>
		<item>
			<title>Web Application</title>
			<link>http://forums.devx.com/showthread.php?t=173335&amp;goto=newpost</link>
			<pubDate>Mon, 09 Nov 2009 09:23:15 GMT</pubDate>
			<description>Hiiii....

I have created one Desktop Application using c#.net and Sql server 2005. Now I want the same application to be Web Enabled. So How should I start with Web application? Is there any way to convert Desktop application to Web Application.

Please Help...

Thanks in advance...</description>
			<content:encoded><![CDATA[<div>Hiiii....<br />
<br />
I have created one Desktop Application using c#.net and Sql server 2005. Now I want the same application to be Web Enabled. So How should I start with Web application? Is there any way to convert Desktop application to Web Application.<br />
<br />
Please Help...<br />
<br />
Thanks in advance...</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>somone4ks</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173335</guid>
		</item>
		<item>
			<title>Want .net scripts. Pls help</title>
			<link>http://forums.devx.com/showthread.php?t=173304&amp;goto=newpost</link>
			<pubDate>Wed, 04 Nov 2009 17:10:49 GMT</pubDate>
			<description><![CDATA[Hello,
I have started using VB.net & want to create my own website.
I want to display image,redirect the pages,make reg. forums.
I want the scripts to write in the default.aspx so that my site runs smoothly.
Pls help me guys.]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
I have started using VB.net &amp; want to create my own website.<br />
I want to display image,redirect the pages,make reg. forums.<br />
I want the scripts to write in the default.aspx so that my site runs smoothly.<br />
Pls help me guys.</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>vanditneel</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173304</guid>
		</item>
		<item>
			<title>Textbox text changed and js confirmbox</title>
			<link>http://forums.devx.com/showthread.php?t=173291&amp;goto=newpost</link>
			<pubDate>Tue, 03 Nov 2009 12:26:55 GMT</pubDate>
			<description><![CDATA[have multiple textboxs which are created dynamically in page_load.
TextBox tb = new TextBox();
tb.id = "ID1";
tb.text = GetfromDB();
tb.TextChanged +=new EventHandler(tb_TextChanged);

Now i want to add a javascript confirmbox as
tb.Attributes.Add("onchange","java_script:return confirm('Data has Changed. Click OK To Continue');");

If the user clicks ok then continue to tb_TextChanged function and if user clicks cancel i want to restore the previous value of textbox.
How can i write the javascript function?

Thanks]]></description>
			<content:encoded><![CDATA[<div>have multiple textboxs which are created dynamically in page_load.<br />
TextBox tb = new TextBox();<br />
tb.id = &quot;ID1&quot;;<br />
tb.text = GetfromDB();<br />
tb.TextChanged +=new EventHandler(tb_TextChanged);<br />
<br />
Now i want to add a javascript confirmbox as<br />
tb.Attributes.Add(&quot;onchange&quot;,&quot;javascript<b></b>:return confirm('Data has Changed. Click OK To Continue');&quot;);<br />
<br />
If the user clicks ok then continue to tb_TextChanged function and if user clicks cancel i want to restore the previous value of textbox.<br />
How can i write the javascript function?<br />
<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>babashankar</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173291</guid>
		</item>
		<item>
			<title>Getting an Image from webBrowser</title>
			<link>http://forums.devx.com/showthread.php?t=173282&amp;goto=newpost</link>
			<pubDate>Mon, 02 Nov 2009 03:33:51 GMT</pubDate>
			<description><![CDATA[Hello !
I would like to programmatically download and save the image
webBrowser2.Url = new Uri("http://www.somewhere.com/images/captcha.png");
                do
                {
                    System.Threading.Thread.Sleep(100);
                } while (webBrowser2.IsBusy || !webBrowser2.DocumentStream.CanRead);

                Bitmap i = new Bitmap(webBrowser2.DocumentStream);
                i.Save("myimage.jpg");
what wrong with my code ? it dont work , hix .
I want to use webBrowser to download image in this session because this image is randomly generated in every request, for example, if i open the page it show an image, if i refresh the page the image changes.

I think the Stream from  webBrowser is incorrect .
webBrowser2.Url = new Uri("http://www.somewhere.com/images/captcha.png");
webBrowser2.DocumentStream <= this is not image stream .
Have you another way to get correct image stream from webBrowser2 ?

Thanks in advance]]></description>
			<content:encoded><![CDATA[<div>Hello !<br />
I would like to programmatically download and save the image<br />
webBrowser2.Url = new Uri(&quot;http://www.somewhere.com/images/captcha.png&quot;);<br />
                do<br />
                {<br />
                    System.Threading.Thread.Sleep(100);<br />
                } while (webBrowser2.IsBusy || !webBrowser2.DocumentStream.CanRead);<br />
<br />
                Bitmap i = new Bitmap(webBrowser2.DocumentStream);<br />
                i.Save(&quot;myimage.jpg&quot;);<br />
what wrong with my code ? it dont work , hix .<br />
I want to use webBrowser to download image in this session because this image is randomly generated in every request, for example, if i open the page it show an image, if i refresh the page the image changes.<br />
<br />
I think the Stream from  webBrowser is incorrect .<br />
webBrowser2.Url = new Uri(&quot;http://www.somewhere.com/images/captcha.png&quot;);<br />
webBrowser2.DocumentStream &lt;= this is not image stream .<br />
Have you another way to get correct image stream from webBrowser2 ?<br />
<br />
Thanks in advance</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>HoangTuDauMat</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173282</guid>
		</item>
		<item>
			<title>fill dataset with 2 table using oledbdataAdaptor</title>
			<link>http://forums.devx.com/showthread.php?t=173263&amp;goto=newpost</link>
			<pubDate>Fri, 30 Oct 2009 02:40:42 GMT</pubDate>
			<description><![CDATA[hi, recently i want to do above process.

i have a query that join 2 table. i need to fill both table into dataAdaptor then fill into a dataset then use for crystalReport.

what should i do?? is this correct?

Code:
---------
        Dim cmd As New OleDbCommand
        Dim conSQL As New OleDbConnection(ConfigurationSettings.AppSettings().Item("connectionStringR"))
        Dim sqlStr as String = "Select * from tableA join tableB on tableA.id=tableB.aid"
        Dim odbcCommand As String 
        conSQL.Open()
        odbcCommand = sqlStr
        cmd.CommandText = odbcCommand
        da.SelectCommand = cmd
        da.SelectCommand.Connection = conSQL
        da.TableMappings.Add("Table", "tableA")
        da.TableMappings.Add("Table1", "tableB")
        da.Fill(ds)
        CrtRptSource.ReportDocument.SetDataSource(ds)
---------
]]></description>
			<content:encoded><![CDATA[<div>hi, recently i want to do above process.<br />
<br />
i have a query that join 2 table. i need to fill both table into dataAdaptor then fill into a dataset then use for crystalReport.<br />
<br />
what should i do?? is this correct?<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; &nbsp; &nbsp; Dim cmd As New OleDbCommand<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim conSQL As New OleDbConnection(ConfigurationSettings.AppSettings().Item(&quot;connectionStringR&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim sqlStr as String = &quot;Select * from tableA join tableB on tableA.id=tableB.aid&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dim odbcCommand As String <br />
&nbsp; &nbsp; &nbsp; &nbsp; conSQL.Open()<br />
&nbsp; &nbsp; &nbsp; &nbsp; odbcCommand = sqlStr<br />
&nbsp; &nbsp; &nbsp; &nbsp; cmd.CommandText = odbcCommand<br />
&nbsp; &nbsp; &nbsp; &nbsp; da.SelectCommand = cmd<br />
&nbsp; &nbsp; &nbsp; &nbsp; da.SelectCommand.Connection = conSQL<br />
&nbsp; &nbsp; &nbsp; &nbsp; da.TableMappings.Add(&quot;Table&quot;, &quot;tableA&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; da.TableMappings.Add(&quot;Table1&quot;, &quot;tableB&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; da.Fill(ds)<br />
&nbsp; &nbsp; &nbsp; &nbsp; CrtRptSource.ReportDocument.SetDataSource(ds)</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>nigege</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173263</guid>
		</item>
		<item>
			<title>Create A Fixed Text File From SQL DB Table</title>
			<link>http://forums.devx.com/showthread.php?t=173261&amp;goto=newpost</link>
			<pubDate>Thu, 29 Oct 2009 23:08:00 GMT</pubDate>
			<description><![CDATA[Hello programmers.  I am trying to retreive data from an SQL db table using VB in a .NET aspx page (visual studio 2005), confirm that there are records (i.e. record count, etc.) then print the data into a fixed text file somewhere on my network.  I did this in Visual Basic 6 using selects, padstrings, freefile, recordcount properties, etc. hitting an Access db table.  However I am not able to repeat this in .aspx page. Below is the script I used to output the text file from the MSAccess table.  Thanks for the support.

Code:
---------
Public Sub tbl2txt()

Dim wrk As dao.Workspace
Dim db As dao.Database
Dim cnn As dao.Connection
Dim rs As dao.Recordset
Dim strTable As String
Dim strFileName As String
Dim intFileNum As Integer

On Error GoTo err_Tbl2Txt

strTable = "QBtmLine"
' Create Microsoft Jet Workspace object.
Set wrk = CreateWorkspace("", "admin", "", dbUseJet)

Set db = wrk.OpenDatabase("U:\DEVHELP_DBs\Ilfornaio\Access2000_a\botline_2k.mdb")

Set rs = db.OpenRecordset("Select * From " & strTable)

With rs
'check to see that records were returned
If rs.RecordCount < 1 Then
MsgBox "No records found for Bottom Line Check File"
Me.Refresh
End If
intFileNum = FreeFile

strFileName = "H:\Acct\BT_2kTesting\blinetxtapp_2k\Blintes1.txt"

Open strFileName For Output As intFileNum

.MoveFirst
Do While Not .EOF

'File is fixed
Print #intFileNum, Format(!paydate, "mm/dd/yy") _
& PadString(Format(!checkamt, "###,#00.00"), " ", 13, False) _
& PadString(!Name, " ", 80, True) & PadString(!add1, " ", 35, True) _
& PadString(!add2, " ", 35, True) & PadString(!add3, " ", 35, True) _
& PadString(!add4, " ", 2, True) & PadString(!postcode, " ", 10, True) _
& (Format(!docdate, "mm/dd/yy") _
& PadString(Format(!invoiceamt, "###,#00.00"), " ", 13, False) _
& PadString(!vendor, " ", 72, False) & PadString(!invno, " ", 34, False) _
& PadString(!checkno, " ", 24, False) & PadString(!sname, " ", 25, True) _
& PadString(!Group, " ", 15, True) & PadString(!groupname, " ", 35, True))

.MoveNext
Loop

End With

Close intFileNum
Set rs = Nothing
db.Close
Set wrk = Nothing
Exit Sub

err_Tbl2Txt:
MsgBox "Error" & Err.Description & "occurred in Tbl2Txt, Correct then Rerun."

End Sub
---------
]]></description>
			<content:encoded><![CDATA[<div>Hello programmers.  I am trying to retreive data from an SQL db table using VB in a .NET aspx page (visual studio 2005), confirm that there are records (i.e. record count, etc.) then print the data into a fixed text file somewhere on my network.  I did this in Visual Basic 6 using selects, padstrings, freefile, recordcount properties, etc. hitting an Access db table.  However I am not able to repeat this in .aspx page. Below is the script I used to output the text file from the MSAccess table.  Thanks for the support.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Public Sub tbl2txt()<br />
<br />
Dim wrk As dao.Workspace<br />
Dim db As dao.Database<br />
Dim cnn As dao.Connection<br />
Dim rs As dao.Recordset<br />
Dim strTable As String<br />
Dim strFileName As String<br />
Dim intFileNum As Integer<br />
<br />
On Error GoTo err_Tbl2Txt<br />
<br />
strTable = &quot;QBtmLine&quot;<br />
' Create Microsoft Jet Workspace object.<br />
Set wrk = CreateWorkspace(&quot;&quot;, &quot;admin&quot;, &quot;&quot;, dbUseJet)<br />
<br />
Set db = wrk.OpenDatabase(&quot;U:\DEVHELP_DBs\Ilfornaio\Access2000_a\botline_2k.mdb&quot;)<br />
<br />
Set rs = db.OpenRecordset(&quot;Select * From &quot; &amp; strTable)<br />
<br />
With rs<br />
'check to see that records were returned<br />
If rs.RecordCount &lt; 1 Then<br />
MsgBox &quot;No records found for Bottom Line Check File&quot;<br />
Me.Refresh<br />
End If<br />
intFileNum = FreeFile<br />
<br />
strFileName = &quot;H:\Acct\BT_2kTesting\blinetxtapp_2k\Blintes1.txt&quot;<br />
<br />
Open strFileName For Output As intFileNum<br />
<br />
.MoveFirst<br />
Do While Not .EOF<br />
<br />
'File is fixed<br />
Print #intFileNum, Format(!paydate, &quot;mm/dd/yy&quot;) _<br />
&amp; PadString(Format(!checkamt, &quot;###,#00.00&quot;), &quot; &quot;, 13, False) _<br />
&amp; PadString(!Name, &quot; &quot;, 80, True) &amp; PadString(!add1, &quot; &quot;, 35, True) _<br />
&amp; PadString(!add2, &quot; &quot;, 35, True) &amp; PadString(!add3, &quot; &quot;, 35, True) _<br />
&amp; PadString(!add4, &quot; &quot;, 2, True) &amp; PadString(!postcode, &quot; &quot;, 10, True) _<br />
&amp; (Format(!docdate, &quot;mm/dd/yy&quot;) _<br />
&amp; PadString(Format(!invoiceamt, &quot;###,#00.00&quot;), &quot; &quot;, 13, False) _<br />
&amp; PadString(!vendor, &quot; &quot;, 72, False) &amp; PadString(!invno, &quot; &quot;, 34, False) _<br />
&amp; PadString(!checkno, &quot; &quot;, 24, False) &amp; PadString(!sname, &quot; &quot;, 25, True) _<br />
&amp; PadString(!Group, &quot; &quot;, 15, True) &amp; PadString(!groupname, &quot; &quot;, 35, True))<br />
<br />
.MoveNext<br />
Loop<br />
<br />
End With<br />
<br />
Close intFileNum<br />
Set rs = Nothing<br />
db.Close<br />
Set wrk = Nothing<br />
Exit Sub<br />
<br />
err_Tbl2Txt:<br />
MsgBox &quot;Error&quot; &amp; Err.Description &amp; &quot;occurred in Tbl2Txt, Correct then Rerun.&quot;<br />
<br />
End Sub</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>ilfoprogrammer</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173261</guid>
		</item>
		<item>
			<title>Store Data Into Dropdownlist Inside GridView EditItemTemplate And FooterTemplate</title>
			<link>http://forums.devx.com/showthread.php?t=173244&amp;goto=newpost</link>
			<pubDate>Tue, 27 Oct 2009 07:48:10 GMT</pubDate>
			<description><![CDATA[Is Anyone Encountered Error as Message Like This ==> ASP.NET Using CSharp Visual Studio 2008

"NullReferenceException was unhandled by user code"

Where I just want to Bind DropdownList that declared inside GridView?
Here where I Construct GridView
=======================================================
<asp:GridView ID="GridOne" runat="server" OnRowDataBound="dvg_RowDatabound" AutoGeneratedColumns="Fales">
<Columns>
  <asp:TemplateField HeaderText="Code">
          <EditItemTemplate>
              <asp:DropDownList ID="DDL" runat="server" ></asp:DropDownList>
          </EditItemTemplate>
  </asp:TemplateField>
</Columns>
</asp:GridView>

================== The Code Behind =====================
protected void dvg_RowDatabound(object sender, GridViewRowEventArgs e)
{

    if (e.Row.RowType == DataControlRowType.DataRow)
      {

             DataTable Dtb = Ds.Table[0];

            DropDownList DDl1 = (DropDownList) e.Row.FindControl("DDl") as  
            DropDownList;


            DDl1.DataSource=Dtb;    << = Error Start Here as Above Error  
                                                     Appear Message

            DDl1.DataMember = "MyDataMember"
            DDl1.DataValueField = "MyValue"
            DDl1.DataBind();

       }


}
=====================================================]]></description>
			<content:encoded><![CDATA[<div>Is Anyone Encountered Error as Message Like This ==&gt; ASP.NET Using CSharp Visual Studio 2008<br />
<br />
&quot;NullReferenceException was unhandled by user code&quot;<br />
<br />
Where I just want to Bind DropdownList that declared inside GridView?<br />
Here where I Construct GridView<br />
=======================================================<br />
&lt;asp:GridView ID=&quot;GridOne&quot; runat=&quot;server&quot; OnRowDataBound=&quot;dvg_RowDatabound&quot; AutoGeneratedColumns=&quot;Fales&quot;&gt;<br />
&lt;Columns&gt;<br />
  &lt;asp:TemplateField HeaderText=&quot;Code&quot;&gt;<br />
          &lt;EditItemTemplate&gt;<br />
              &lt;asp:DropDownList ID=&quot;DDL&quot; runat=&quot;server&quot; &gt;&lt;/asp:DropDownList&gt;<br />
          &lt;/EditItemTemplate&gt;<br />
  &lt;/asp:TemplateField&gt;<br />
&lt;/Columns&gt;<br />
&lt;/asp:GridView&gt;<br />
<br />
================== The Code Behind =====================<br />
protected void dvg_RowDatabound(object sender, GridViewRowEventArgs e)<br />
{<br />
<br />
    if (e.Row.RowType == DataControlRowType.DataRow)<br />
      {<br />
<br />
             DataTable Dtb = Ds.Table[0];<br />
<br />
            DropDownList DDl1 = (DropDownList) e.Row.FindControl(&quot;DDl&quot;) as  <br />
            DropDownList;<br />
<br />
<br />
            DDl1.DataSource=Dtb;    &lt;&lt; = Error Start Here as Above Error  <br />
                                                     Appear Message<br />
<br />
            DDl1.DataMember = &quot;MyDataMember&quot;<br />
            DDl1.DataValueField = &quot;MyValue&quot;<br />
            DDl1.DataBind();<br />
<br />
       }<br />
<br />
<br />
}<br />
=====================================================</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>justhottest</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173244</guid>
		</item>
		<item>
			<title>How to include System.Core.dll (.net 3.5) to a .net 2.0 application</title>
			<link>http://forums.devx.com/showthread.php?t=173234&amp;goto=newpost</link>
			<pubDate>Mon, 26 Oct 2009 11:04:52 GMT</pubDate>
			<description><![CDATA[My project is in .net framwork 2.0 and i want to use TimezoneInfo class.

When i use the below line..it is giving an error like " Type TimezoneInfo is not defined"

Dim zones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()

Actually my requirement is to get all the timezones and functions for getting time by timezoneId.

How can i use  the TimezoneInfo class in .Net 2.0 Application

Thank you,
Dilip.]]></description>
			<content:encoded><![CDATA[<div>My project is in .net framwork 2.0 and i want to use TimezoneInfo class.<br />
<br />
When i use the below line..it is giving an error like &quot; Type TimezoneInfo is not defined&quot;<br />
<br />
Dim zones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()<br />
<br />
Actually my requirement is to get all the timezones and functions for getting time by timezoneId.<br />
<br />
How can i use  the TimezoneInfo class in .Net 2.0 Application<br />
<br />
Thank you,<br />
Dilip.</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>Dilip</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173234</guid>
		</item>
		<item>
			<title>Migration from DataView to ListView</title>
			<link>http://forums.devx.com/showthread.php?t=173233&amp;goto=newpost</link>
			<pubDate>Mon, 26 Oct 2009 09:53:34 GMT</pubDate>
			<description><![CDATA[I'm working on converting a DataView object to a ListView object. What I had previously was working but the source data became so long so I decided to move to ListView so I could do multiple columns.

I'm running into a few problems though. When I was working with DataView I was able to set each Item's checkbox by using OnItemDataBound. The same method for ListView is not working:


Code:
---------
    protected void lv1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            try
            {
                CheckBox chkBox = (CheckBox)e.Item.FindControl("chkSelect");
                using (ListViewDataItem lvdi = (ListViewDataItem)e.Item)
                {
                    if (lvdi != null)
                    {
                        chkBox.ID = "dg1_" + DataBinder.Eval(lvdi.DataItem, "ServerID");
                        chkBox.Text = (string)DataBinder.Eval(lvdi.DataItem, "Server_Name");
                        chkBox.TabIndex = (short)(lvdi.DataItemIndex + 6);
                    }
                }
            }
            catch { }
        }
    }
---------
Upon debugging, I can see chkBox.ID getting set to the new value "dg1_1","dg1_2", etc.
When I look in the source of the page, the first checkbox is name="lv1$ctrl0$ctl00$dg1_1"
However, when I do a postback using a button onClick="doPostBack"


Code:
---------
    protected void doPostBack(object sender, EventArgs e)
    {
        ListView tdg1 = (ListView)this.FindControl("inputform1").FindControl("lv1");
...
        foreach (ListViewItem dgi in tdg1.Items)
        {
            counta += dgi.Controls.Count;
            foreach (Control cc in dgi.Controls)
            {
                debug += cc.ID;
                if (cc.GetType() == typeof(CheckBox))
                {
                    CheckBox cb = (CheckBox)cc;
                    if (cb.Checked == true)
                    {
                        Regex r = new Regex("dg1_(?<id>[0-9]+)");
                        Match m = r.Match(cb.ID);
                        if (m.Success)
...
---------
cb.ID is always chkSelect, and not what I specified in the ItemDataBound.

Has anyone experienced this before? Am I completely insane doing it this way?]]></description>
			<content:encoded><![CDATA[<div>I'm working on converting a DataView object to a ListView object. What I had previously was working but the source data became so long so I decided to move to ListView so I could do multiple columns.<br />
<br />
I'm running into a few problems though. When I was working with DataView I was able to set each Item's checkbox by using OnItemDataBound. The same method for ListView is not working:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; protected void lv1_ItemDataBound(object sender, ListViewItemEventArgs e)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (e.Item.ItemType == ListViewItemType.DataItem)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CheckBox chkBox = (CheckBox)e.Item.FindControl(&quot;chkSelect&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (ListViewDataItem lvdi = (ListViewDataItem)e.Item)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (lvdi != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chkBox.ID = &quot;dg1_&quot; + DataBinder.Eval(lvdi.DataItem, &quot;ServerID&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chkBox.Text = (string)DataBinder.Eval(lvdi.DataItem, &quot;Server_Name&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chkBox.TabIndex = (short)(lvdi.DataItemIndex + 6);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch { }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</code><hr />
</div>Upon debugging, I can see chkBox.ID getting set to the new value &quot;dg1_1&quot;,&quot;dg1_2&quot;, etc.<br />
When I look in the source of the page, the first checkbox is name=&quot;lv1$ctrl0$ctl00$dg1_1&quot;<br />
However, when I do a postback using a button onClick=&quot;doPostBack&quot;<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&nbsp; &nbsp; protected void doPostBack(object sender, EventArgs e)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ListView tdg1 = (ListView)this.FindControl(&quot;inputform1&quot;).FindControl(&quot;lv1&quot;);<br />
...<br />
&nbsp; &nbsp; &nbsp; &nbsp; foreach (ListViewItem dgi in tdg1.Items)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; counta += dgi.Controls.Count;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (Control cc in dgi.Controls)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debug += cc.ID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (cc.GetType() == typeof(CheckBox))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CheckBox cb = (CheckBox)cc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (cb.Checked == true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Regex r = new Regex(&quot;dg1_(?&lt;id&gt;[0-9]+)&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Match m = r.Match(cb.ID);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (m.Success)<br />
...</code><hr />
</div>cb.ID is always chkSelect, and not what I specified in the ItemDataBound.<br />
<br />
Has anyone experienced this before? Am I completely insane doing it this way?</div>

]]></content:encoded>
			<category domain="http://forums.devx.com/forumdisplay.php?f=111">ASP.NET</category>
			<dc:creator>theit8514</dc:creator>
			<guid isPermaLink="true">http://forums.devx.com/showthread.php?t=173233</guid>
		</item>
	</channel>
</rss>
