|
In VB.NET you need to specify the function that implements the interface so instead of
<br />
Public Function ValidateControl As String<br />
Dim A As String = "Yes"<br />
Return A<br />
End Function<br />
you need to decorate the method signature as:
<br />
Public Function ValidateControl As String Implements IContent.IContent.ValidateControl<br />
Dim A As String = "Yes"<br />
Return A<br />
End Function<br />
The code in the final section is almost right - it should look like this:
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)<br />
Dim child As IContent.IContent<br />
child = DirectCast(Me.Page, IContent.IContent)<br />
child.ValidateControl()<br />
End Sub<br />
Obviously you'll want to change the return type of 'ValidateControl()', probably so that it returns a boolean rather than a string. You can do this by changing the signature specified by the interface and then making the appropriate function change so that a true or false value is returned depending on whether the control was successfully validated.
Interfaces are very important in OO design so I'd recommend having a look around the internet (starting with CodeProject!) for some decent articles.
Hope that helps
It definitely isn't definatley
modified on Thursday, December 4, 2008 12:55 PM
|
|
|
|
|
Works!!
Thank you very much for your kind help.
Sure I will try to improve my OO design skills.
|
|
|
|
|
Hi this is Rajesh,
I am developing Fillable pdf form document management system using Asp.net. In that am displaying the pdf forms to Users by using IFRAME control like below...
<iframe src="fw9.pdf" width="970px" height="435px"></iframe>
And my question is, how to get or save the filled PDF form to the server.
is there anyway or any controls to do the above work... Let me know...
Thanks
Regards
C.Rajesh B.E
|
|
|
|
|
i have downloaded ur code of gridview with check boxes ...there u r not provided the functions....RetrieveItems()and DeleteRows() ...so i have written on my own ...i am getting 2 errors:
1.---->'gridview.RetrieveItems()': not all code paths return a value
2.----> No overload for method 'DeleteRows' takes '1' arguments
so plz go through the code and help me out its urgent....
thanks in advance.....
Here's the aspx.cs code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.SqlClient;
public partial class gridview : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Include the JavaScript functions during Form_Load() itself.
CheckBoxJSFunctions();
if (!Page.IsPostBack)
{
PopulateGrid();
}
}
private static DataTable RetrieveItems() //Error No:1
{
//Create a connection to the SQL Server; modify the connection string for your environment
//SqlConnection MyConnection = new SqlConnection ("server=(local);database=pubs;Trusted_Connection=yes");
SqlConnection MyConnection = new SqlConnection("server=(local);database=pubs;UID=myUser;PWD=myPassword;");
// Create a Command object, and then set the connection.
// The following SQL statements check whether a GetAuthorsByLastName
// stored procedure already exists.
SqlCommand MyCommand = new SqlCommand("select * from sysobjects where id = object_id(N'GetPosts')" +
" and OBJECTPROPERTY(id, N'IsProcedure') = 1", MyConnection);
// Set the command type that you will run.
MyCommand.CommandType = CommandType.Text;
// Open the connection.
MyCommand.Connection.Open();
// Run the SQL statement, and then get the returned rows to the DataReader.
SqlDataReader MyDataReader = MyCommand.ExecuteReader();
// If any rows are returned, the stored procedure that you are trying
// to create already exists. Therefore, try to create the stored procedure
// only if it does not exist.
if(!MyDataReader.Read())
{
MyCommand.CommandText = "create procedure GetPosts" +
" (@date varchar(40),@title varchar(50),(@author varchar(40),@categories varchar(50),(@tags varchar(40),@comments varchar(50)(@status varchar(40), select * from Posts where" +
" Date like @date,PTittle like @title,Author like @author,Category like @categories,Tags like @tags,TotalComments like comments,PStatus like @status; select @RowCount=@@ROWCOUNT";
MyDataReader.Close();
MyCommand.ExecuteNonQuery();
}
else
{
MyDataReader.Close();
}
MyCommand.Dispose(); //Dispose of the Command object.
MyConnection.Close(); //Close the connection.
}
private void PopulateGrid()
{
// RetrieveItems() is a user defined function that calls the stored proc to retrieve data from the database.
DataTable dtItems = RetrieveItems();
GridView1.DataSource = dtItems;
GridView1.DataBind();
}
private void CheckBoxJSFunctions()
{
StringBuilder strScript = new StringBuilder();
strScript.Append("<script language=JavaScript>");
strScript.Append("function CheckAll(checkAllBox)");
strScript.Append("{");
strScript.Append("var frm = document.form1;");
strScript.Append("var ChkState = checkAllBox.checked;");
strScript.Append("for(i=0; i<frm.length; i++)");
strScript.Append("{");
strScript.Append("e=frm.elements[i];");
strScript.Append("if(e.type == 'checkbox' && e.name.indexOf('Id') != -1)");
strScript.Append("e.checked = ChkState ;");
strScript.Append("}");
strScript.Append("}");
strScript.Append("</script>");
if (!this.IsClientScriptBlockRegistered("clientScriptCheckAll"))
this.RegisterClientScriptBlock("clientScriptCheckAll", strScript.ToString());
//------------------------------------------------------------------------------
strScript.Append("<script language=JavaScript>");
strScript.Append("function CheckChanged()");
strScript.Append("{");
strScript.Append("var frm = document.form1;");
strScript.Append("var boolAllChecked;");
strScript.Append("boolAllChecked=true;");
strScript.Append("for(i=0; i<frm.length; i++)");
strScript.Append("{");
strScript.Append("e = frm.elements[i];");
strScript.Append("if (e.type =='checkbox' && e.name.indexOf('Id') != -1 )");
strScript.Append("if(e.checked == false)");
strScript.Append("{");
strScript.Append("boolAllChecked = false;");
strScript.Append("break;");
strScript.Append("}");
strScript.Append("}");
strScript.Append("for(i=0; i<frm.length; i++)");
strScript.Append("{");
strScript.Append("e=frm.elements[i];");
strScript.Append("if ( e.type =='checkbox' && e.name.indexOf('checkAll') != -1 )");
strScript.Append("{");
strScript.Append("if( boolAllChecked == false)");
strScript.Append("e.checked = false ;");
strScript.Append("else if(boolAllChecked == true)");
strScript.Append("e.checked = true;");
strScript.Append("break;");
strScript.Append("}");
strScript.Append("}");
strScript.Append("}");
strScript.Append("</script>");
if (!this.IsClientScriptBlockRegistered("clientScriptCheckChanged"))
this.RegisterClientScriptBlock("clientScriptCheckChanged", strScript.ToString());
}
// Function to get the selected checkbox values
private string GetSelected()
{
// Initially set the values to Blank
h_chkSelected.Value = "";
foreach (GridViewRow di in GridView1.Rows)
{
HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("chkBoxId");
if (chkBx != null && chkBx.Checked)
{
Label lbl = (Label)di.FindControl("RowId");
h_chkSelected.Value = h_chkSelected.Value + lbl.Text + ",";
}
}
// If no checkbox selected, do not proceed further
string strDataToSend = "";
if (h_chkSelected.Value != "")
{
//Strip off the last comma before sending to stored proc
strDataToSend = h_chkSelected.Value;
strDataToSend = strDataToSend.Substring(0, strDataToSend.Length - 1);
}
return strDataToSend;
}
protected void btnDelete_Click(object sender, EventArgs e)
{
// This variable contains the selected rows in the format 1,2,3
string SelectedRows = GetSelected();
// User defined function that calls the stored proc to delete the selected items
DeleteRows(SelectedRows);
}
public virtual void DeleteRows()//error No:2
{
int rowIndex;
}
}
|
|
|
|
|
premprakashbhati wrote: 1.---->'gridview.RetrieveItems()': not all code paths return a value
Your RetrieveItems() function states that it will return an object of type DataTable but there doesn't appear to be a single 'return' statement in this function. Write one.
premprakashbhati wrote:
2.----> No overload for method 'DeleteRows' takes '1' arguments
You're calling DeleteRows with a string parameter but this function signature doesn't exist. Write it.
premprakashbhati wrote:
so plz go through the code and help me out its urgent....
thanks in advance.....
That's all the help I'm giving.
It definitely isn't definatley
|
|
|
|
|
premprakashbhati wrote: help me out its urgent....
No. Not my problem.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
When ever I tried to connect with sql database in asp.net server exploror
then this massage come in sight that's why I am not able to access the database, I reinstalled both sql server 2005 and also management studio.But still facing same problem
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc,Version = 10.0.0.0,Culture = neutral,
PublicKey Token = 89845dcd8080cc91' or one of its dependencies.
Kindly do replay.
Sajjad Ali
|
|
|
|
|
Why can't you just google it up the error and get the solution rather than waiting for one day?
Check this site. probably it may help you.
Sql Server Error
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
you are using vs2008? and you are trying to import this file. is it so?
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
yes i am using vs 2008 but at the last i solved it,the problem is in
IDE of vs 2008
Its because when i import database in vs 2005 server explorer database then without any problem database easily imported.
Now sir i just want to know what was wrong with vs 2008.
Kindly do replay because it may be happen again.
Sajjad ALi
Junior web developer
110 Solutions
|
|
|
|
|
Import the Database in Visual Studio?
IN Visual Studio we connect the Sql Server Database and do not import it.
dont get confused.
|
|
|
|
|
can any one guide me that i want to fill two dropdown lists country and cities relevant to that.....
my requirement is to select country and its cities must be filled automatically... before that i used to do it by filling country and cities in database using primary and foreign key relationship....
is there any api or webservice available for that????
umerumerumer
modified on Thursday, December 4, 2008 6:25 AM
|
|
|
|
|
Use Update panels in Ajax so that the States will get automatically updated once you select the countries.
For code reference, please refere to this sites:
1) Experts Exchange
2)MSDN
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Other then what meeram has suggested. You can do it through js as well.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Hello there,
I've created UserControl which is used as a menu. It is populated dynamically and has two levels.
The weird thing is though that second level controls' click event is fired but it the code executed in it seems to have no effect at all:
public void SubCourseRoundMenuClick(object a, CommandEventArgs e)
{
pnlCourseEvents.Visible = false;
pnlCourseSubEvents.Style["display"] = "block";
}
Both properties changes to their old values when observed in any event fired after SubCourseRoundMenuClick.
All menu items and subitems are populated at the same order on every postback. EnableViewState=false on UserControl (though i've tried other way round as well).
For suspect ViewState is playing tricks on me.
This issue is really driving me bonkers so any advice or guidance would be much appreciated.
Best Regards,
Dave
|
|
|
|
|
Do you modify these values in page_prerender, which fires afterwards ?
I am not sure how viewstate factors into it. Or are you saying that the control resets to it's default state on the next postback ? Perhaps you need to store something in the viewstate to tell you the state of this control ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Christian,
What I'm saying is that anything I change in click event handler of UserControl doesn't seem to work. I've even tried adding private variable
private int test; . I've changed it in click event handler and it's back to 0 in any event fired afterwards. Bear in mind that it's the same postback!!!. And that is very very weird
Regards,
Dave
|
|
|
|
|
what is the purpose of repeater control in asp.net
|
|
|
|
|
|
The Repeater control displays data items in a repeating list. Similar to DataList, the content and layout of list items in Repeater is defined using templates.
Unlike DataList, Repeater has no built-in layout or styles.You must explicitly declare all HTML layout, formatting, and style tags within the templates of the control.
i hope below link will give enough info
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/repeater.aspx[^]
|
|
|
|
|
madan raj wrote: repeater control
Is it not, to some extent at least, implicit what a repeater control would do?
|
|
|
|
|
hi,
i am working on a asp.net project ,in which there is a need to upload a dovcument ,which will be converted to image.
the problem is i need to select a particular word or sentence to annotate.what i want to know is ,how can select a particluar area in a image , and identify the text.
regards
navin
|
|
|
|
|
Navinchandran wrote: i want to know is ,how can select a particluar area in a image , and identify the text.
Here I give you sample code.
This helps you.
Bitmap b = new Bitmap(500, 100);
Graphics g = Graphics.FromImage((System.Drawing.Image)b);
//g.FillRegion(Brushes.Red,
string message = "This is the string to highlight a word in.";
// Declare the word to highlight.
string searchWord = "string";
// Create a CharacterRange array with the searchWord
// location and length.
CharacterRange[] ranges =
new CharacterRange[]{new CharacterRange
(message.IndexOf(searchWord), searchWord.Length)};
// Construct a StringFormat object.
StringFormat stringFormat1 = new StringFormat();
// Set the ranges on the StringFormat object.
stringFormat1.SetMeasurableCharacterRanges(ranges);
// Declare the font to write the message in.
Font largeFont = new Font(FontFamily.GenericSansSerif, 16.0F,
GraphicsUnit.Pixel);
// Construct a new Rectangle.
Rectangle displayRectangle = new Rectangle(20, 20, 200, 100);
// Convert the Rectangle to a RectangleF.
RectangleF displayRectangleF = (RectangleF)displayRectangle;
// Get the Region to highlight by calling the
// MeasureCharacterRanges method.
Region[] charRegion = g.MeasureCharacterRanges(message,
largeFont, displayRectangleF, stringFormat1);
// Draw the message string on the form.
g.DrawString(message, largeFont, Brushes.Blue,
displayRectangleF);
// Fill in the region using a semi-transparent color.
g.FillRegion(new SolidBrush(Color.FromArgb(50, Color.Fuchsia)),
charRegion[0]);
b.Save(Server.MapPath("MyImage.png"), System.Drawing.Imaging.ImageFormat.Png);
Regard
IMrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
I'm not sure what the other guy was saying, but you need an OCR library to find text in an image. Then you need to work out where that text is ( which is a different thing ) so you can highlight it. A far from trivial task.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I want that my query automatically runs in google and the output list of all the sites on first page get added to my sql database.
i am able to run my query get the output but dont know how to pull it into database.
Monu
|
|
|
|