|
I'm returning a dataset to a gridview control. When the gridview asp.net
control is populated from the returning dataset, if dataset is empty. The cells that are empty, in the gridview control, I would like to have the value of 0 (zero) inserted. So if no data is returned to that cell a 0 (zero) is shown.
|
|
|
|
|
First check the dataset is empty. If it is then add rows manually for the datatables. and bind that to the grid view.
|
|
|
|
|
Try This
Protected Sub ItemDB(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Dim dv As DataView = CType(DataGrid1.DataSource, DataView)
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
If dv.Table.Rows.Count = 0 Then
'By default the Datagrid Header is shown in case there is no Data Avaiable
'So in case of No Data found
'Check the ListItemType.Header
If e.Item.ItemType = ListItemType.Header Then
Dim i As Integer = e.Item.Cells.Count
'Assign "No Search result Found" in one of the cells of DataGrid
e.Item.Cells(0).Text = "No Search Results Found"
'Remove Rest of the empty cells from Datagrid
Dim j As Integer
For j = i - 1 To 1 Step -1
e.Item.Cells.RemoveAt(j)
Next
End If
End If
End Sub '
manojchilhate
|
|
|
|
|
Hello To Everyone,
I used as follow:
dim pass as string
pass="Hemant"
TextBox1.Text = pass
i'm wrting the code Page_load...
it is working for label but not textbox
but nothing is coming in textBox....
What is problem.?
Suggest me what eRRor is ther..
Thank You.
|
|
|
|
|
did you do the following:
Page_Load
If NOT IsPostBack Then
dim pass as string
pass="Hemant"
TextBox1.Text = pass
EndIf
End Sub
|
|
|
|
|
Yes i did the following but still not working
|
|
|
|
|
It should work even without "Not IsPostback", Create a new application. May be there is problem in your current app.
|
|
|
|
|
Debug step by step, you will come to know the problem
|
|
|
|
|
Put the break point and check so that you will know where the error is.
Regards,
Satips.
|
|
|
|
|
It seems, you have set the TextMode property of the TextBox to Password. You cannot assign the Text for Password TextBox. If you do, it will be cleared automatically.
|
|
|
|
|
Is TextBox1.TextMode Password?
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
I have a web project which writes something in a Response object and displays to the user in an excel file. The code looks like:
<br />
Response.Clear();<br />
Response.ContentType = "application/vnd.ms-excel";<br />
Response.Charset = "";<br />
Response.AddHeader("content-disposition", "attachment; filename=abc.xls");<br />
this.EnableViewState = false;<br />
<br />
XmlTextWriter xml = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);<br />
<br />
...<br />
...<br />
...<br />
...<br />
<br />
Response.Flush();<br />
Response.End();<br />
When I try to run this code it runs perfectly. But when I try to excapsulate it in a Class Library, it says Response object cannot be used in the context. True, I understand. But then is there a way I can response the following in memory text to user to display excel.
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
|
|
|
|
|
HttpContext.Current.Response
only two letters away from being an asset
|
|
|
|
|
My Class Library is not able to use HttpContext.Current.Response. I tried using the namespace System.Web too. But invain. Pls help.
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
|
|
|
|
|
Pass the Response Object as a parameter to the Class and use that Object to do the Response actions.
|
|
|
|
|
Unnecessary, the code is running in appdomain and thus has access to the Response object directly.
only two letters away from being an asset
|
|
|
|
|
Hello any one knows how to add controls to gridview dynamically and get the value of it
Please help me..........
Nagu
-- modified at 1:37 Tuesday 19th June, 2007
|
|
|
|
|
Please select the suitable topic for your subject.
Dont post it as "please help me"
Regards,
Satips.
|
|
|
|
|
Sorry i am new to this forum
|
|
|
|
|
Before posting did you read the guidlines for posting it in the forum.
Regards,
Satips.
|
|
|
|
|
DataGridViewComboBoxColumn Column2 = new DataGridViewComboBoxColumn();
this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] {Column2});
|
|
|
|
|
|
Hello To Everyone,
I used as follow:
dim pass as string
pass="Hemant"
TextBox1.Text = pass
i'm wrting the code Page_load...
it is working for label but not textbox
but nothing is coming in textBox....
What is problem.?
Suggest me what eRRor is ther..
Thank You.
-- modified at 1:36 Tuesday 19th June, 2007
|
|
|
|
|
Where are you using this code?
only two letters away from being an asset
|
|
|
|
|
i'm wrting the code Page_load...
it is working for label but not textbox
-- modified at 1:34 Tuesday 19th June, 2007
|
|
|
|