I have a datagrid control on my page populated from a parameterized stored procedure. The parameter comes from a label control on my page as seen below. I cannot get the grid to populate. Any suggestions?
Dim LocalIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If LocalIP =""Then
LocalIP = Request.ServerVariables("REMOTE_ADDR")
EndIf
Label1.Text = LocalIP
TIA <JP>
Hi paskettj,
first check if Label1.text has been assigned to the correct value(mean, what's the value of " LocalIP" ? you can use debug, or response.write to monitor it);
secondly,check if your sotred procedure has returned the correct data;
and the third, pls check if you have use datagrid correctly. To get your datagrid control populated with corresponding data,First, you need to set the correct DataSource or DataSourceID, then call the Databind() method. It doesn't matter where you get your data from(whether it's from a table,backend database, from parameterized stored procedure...etc).
for more detailed information, i suggest you reading some material by clicking the following links:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.basedatalist.datasource(VS.71).aspx (the sample within this page should help u use datagrid)
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx (to a overview of datagird class)
hope my suggestion helps :)
0 comments:
Post a Comment