Hi All,
I want to add values into the dropdownlist present on the infopath form at run time thru managed code. How can i do so ? I tried cloning the root and then appending the new child to the root. The code snippet is as follows :
while (rdr.Read())//read through rows
{
sqlConnection2.Open();
string T_Id = rdr[2].ToString();
string cmdTxt = "select distinct TaskId,TaskName from MainTaskTB where TaskId=" + T_Id + " order by TaskId";
cmd = new SqlCommand(cmdTxt);
cmd.Connection = sqlConnection2;
rdr1 = cmd.ExecuteReader();
while (rdr1.Read())
{
temp = root.Clone();
temp2 = temp;
temp3 = temp2.SelectSingleNode("/my:myFields/my:WorkAssignedDetails/my:MainTask", this.NamespaceManager);
DeleteNil(temp3);
temp3.SetValue(rdr1[1].ToString());
}
//temp.AppendChild(temp2);
temp.InsertAfter(temp2);
}
root.DeleteSelf();
I am getting an error after the "temp.InsertAfter(temp2)" saying that "Schema validation has non-datatype errors". For this, infopath team blogs gave me a solution saying to add a function called "DeleteNil(paramater)". I did that too but still facing the same error.
Awaiting reply soon.
Regards,
Anandhi