|
well fire the event for filling the gridview on the onclick event of the button
there are plenty of tutorials for binding data to a gridview and its fairly straightforward
We are not a Code Charity
|
|
|
|
|
thanks for replaying me.
but the problem is
my button is in usercontrol and gridview is in aspx page.
how i fire event of usercontrol in aspx page.
please tell me.
|
|
|
|
|
check this out:
http://forums.asp.net/p/1279478/2441374.aspx
and this
http://forums.asp.net/p/1262933/2365263.aspx
We are not a Code Charity
|
|
|
|
|
Hi,
Sorry for the delay...there was a problem in the site..
You need to raise an event to the page. Here is how to do it.
First let’s create delegate and define an event of type of the delegate. And call that event in the button click event.
Add this code your ascx.cs file
public delegate void LoadGridHandler();
public event LoadGridHandler LoadGrid;
protected void Button1_Click(object sender, EventArgs e)
{
this.LoadGrid();
}
Now, in your aspx file, raise that event during the page load of your page.
Take this code..
protected void Page_Load(object sender, EventArgs e)
{
MyControl1.LoadGrid += new Controls_MyControl.LoadGridHandler(MyControl1_LoadGrid);
}
void MyControl1_LoadGrid()
{
//write the method to load you grid
Response.Write("Hi from Gayani");
}
Hope it works
Thx,
Gayani
|
|
|
|
|
thanks a lot.
i fixed my problem.
|
|
|
|
|
Hello!
I've got an aspx-file which I use for AJAX to return different stuff depending on querystring. I one case I return an webusercontrol(.ascx) with a bunch of controls including a couple of validators. When I try to do this:
myWebUserControl.RenderControl(myHtmlTextWriter)
none of the asp:validator-controls gets rendered in html. This includes asp:RequiredFieldValidator and asp:ValidationSummary. What do I have to do in order for those controls to also be rendered?
|
|
|
|
|
In design mode drag the .ascx onto the form. put the control inside a panel
in the page load set panel.style.value = "display:none";
in ajax event when you want to display the ascx set panel.style.value = "";
Did that help?
I didn't get any requirements for the signature
|
|
|
|
|
Hello and thanks for your reply! Actually this did solve part of the problem. Now I do get html for the validators like this:
span id="Login1_validatorReqFieldUserName" style="color: Red; display: none;"
but I don´t seem to get the javascripts that makes the actual validation work.
|
|
|
|
|
ButtonClick
strSql = "Select [Type],[Image] from [Details]"
cClass.ExecuteReader(strSql)
If cClass.dataReader.Read Then
TextBox1.Text = cClass.dataReader.Item("Type").ToString
Image1.ImageUrl = cClass.dataReader.Item("Image")
End If
End ButtonClick
'Class here
Public Sub ExecuteReader(ByVal strSql As String)
Try
codeSuccess = False
dataCommand = New SqlCommand(strSql, oConn)
dataReader = dataCommand.ExecuteReader()
codeSuccess = True
Catch ex As Exception
errMsg = ex.Message.ToString
End Try
End Sub
'End Function
I want to show a pic in an Image1 but it does not work, any suggestions please.
Thanks in advance
Phetolel
|
|
|
|
|
phetolel wrote: but it does not work
what is happening?
Have you def got an image stored in the datbase, is it stored in the correct format?
We are not a Code Charity
|
|
|
|
|
I've got an image stored in ms sql 2005
the field is of image type.
thanks
|
|
|
|
|
what is happening?
Are you getting an error?
We are not a Code Charity
|
|
|
|
|
I'm getting this error
Conversion from type 'Byte()' to type 'String' is not valid.
|
|
|
|
|
check this out:
http://www.aspfree.com/c/a/ASP.NET/Retrieving-Images-from-a-Database--C---Part-II/
your error is a big clue, which line of the code does it have a problem with, is it this line:
TextBox1.Text = cClass.dataReader.Item("Type").ToString
We are not a Code Charity
|
|
|
|
|
i made a class to export gridview to excel.....its working fine on local server...but when i upload this class on server it is giving this error...
The name 'GridViewExportUtil' does not exist in the current context
please tell me how to use this class..
|
|
|
|
|
I might be wrong but is the class stored in the correct folder, i.e. app_code folder?
We are not a Code Charity
|
|
|
|
|
yeah i put my class in App_Code folder....should i make dll for my class...i didn't make that....please help me
|
|
|
|
|
It depends how your website functions.
Have you previously copied a dll across?
I know that if you write the c# in visual studio and then upload dll then the most updated pages of code must be in that dll
To answer your question then yes put it in the dll
We are not a Code Charity
|
|
|
|
|
I am getting a text box value in to a variable by using java script
a=document.getElementById("mstxtOSRPoor1").value;
How can I trim this text?
Thanks in adv
Balasubramanian K.
|
|
|
|
|
Check this out:
http://www.delphifaq.com/faq/f1031.shtml
We are not a Code Charity
|
|
|
|
|
Thank you very much. It is very useful.
Balasubramanian K.
|
|
|
|
|
faching a problem
Error 1 'System.Data.OleDb.OleDbCommand' does not contain a definition for 'BeginExecuteReader
how to solve this problem
if i use this process in sqlserver 2000 then no problem
but i use this process in access then i faching a problem
Thank's and Best Regords
Ashutosh
|
|
|
|
|
Can you post your entire code
We are not a Code Charity
|
|
|
|
|
IAsyncResult BeginAsyncWork1(Object sender, EventArgs e, AsyncCallback cb, object state)
{
string db = Server.MapPath("~/DB/AsynchronousProcess.mdb");
string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" + db + "';";
_connection1 = new OleDbConnection(connectionstring);
_connection1.Open();
int i;
for (i = 2; i <= 1001; i++)
{
_command1 = new OleDbCommand("Insert Into Information values('xyz',#01/01/01#)", _connection1);
_command1.ExecuteNonQuery();
}
return _command1.BeginExecuteReader(cb, state);
}
|
|
|
|
|
check you have
using System.Data.OleDb;
at the top of your page
We are not a Code Charity
|
|
|
|